1" Tests for the preview window 2source check.vim 3CheckFeature quickfix 4 5func Test_Psearch() 6 " this used to cause ml_get errors 7 help 8 let wincount = winnr('$') 9 0f 10 ps. 11 call assert_equal(wincount + 1, winnr('$')) 12 pclose 13 call assert_equal(wincount, winnr('$')) 14 bwipe 15endfunc 16 17func Test_window_preview() 18 CheckFeature quickfix 19 20 " Open a preview window 21 pedit Xa 22 call assert_equal(2, winnr('$')) 23 call assert_equal(0, &previewwindow) 24 25 " Go to the preview window 26 wincmd P 27 call assert_equal(1, &previewwindow) 28 29 " Close preview window 30 wincmd z 31 call assert_equal(1, winnr('$')) 32 call assert_equal(0, &previewwindow) 33 34 call assert_fails('wincmd P', 'E441:') 35endfunc 36 37func Test_window_preview_from_help() 38 CheckFeature quickfix 39 40 filetype on 41 call writefile(['/* some C code */'], 'Xpreview.c') 42 help 43 pedit Xpreview.c 44 wincmd P 45 call assert_equal(1, &previewwindow) 46 call assert_equal('c', &filetype) 47 wincmd z 48 49 filetype off 50 close 51 call delete('Xpreview.c') 52endfunc 53 54func Test_multiple_preview_windows() 55 new 56 set previewwindow 57 new 58 call assert_fails('set previewwindow', 'E590:') 59 %bw! 60endfunc 61 62" vim: shiftwidth=2 sts=2 expandtab 63