diff options
Diffstat (limited to 'test/old/testdir/test_preview.vim')
-rw-r--r-- | test/old/testdir/test_preview.vim | 59 |
1 files changed, 52 insertions, 7 deletions
diff --git a/test/old/testdir/test_preview.vim b/test/old/testdir/test_preview.vim index b7b908e761..422c50ac77 100644 --- a/test/old/testdir/test_preview.vim +++ b/test/old/testdir/test_preview.vim @@ -15,6 +15,20 @@ func Test_Psearch() bwipe endfunc +func s:goto_preview_and_close() + " Go to the preview window + wincmd P + call assert_equal(1, &previewwindow) + call assert_equal('preview', win_gettype()) + + " Close preview window + wincmd z + call assert_equal(1, winnr('$')) + call assert_equal(0, &previewwindow) + + call assert_fails('wincmd P', 'E441:') +endfunc + func Test_window_preview() CheckFeature quickfix @@ -23,17 +37,48 @@ func Test_window_preview() call assert_equal(2, winnr('$')) call assert_equal(0, &previewwindow) - " Go to the preview window - wincmd P - call assert_equal(1, &previewwindow) - call assert_equal('preview', win_gettype()) + call s:goto_preview_and_close() +endfunc + +func Test_window_preview_from_pbuffer() + CheckFeature quickfix + + call writefile(['/* some C code */'], 'Xpreview.c', 'D') + edit Xpreview.c + const buf_num = bufnr('%') + enew + + call feedkeys(":pbuffer Xpre\<C-A>\<C-B>\"\<CR>", 'xt') + call assert_equal("\"pbuffer Xpreview.c", @:) - " Close preview window - wincmd z call assert_equal(1, winnr('$')) + exe 'pbuffer ' . buf_num + call assert_equal(2, winnr('$')) call assert_equal(0, &previewwindow) - call assert_fails('wincmd P', 'E441:') + call s:goto_preview_and_close() + + call assert_equal(1, winnr('$')) + pbuffer Xpreview.c + call assert_equal(2, winnr('$')) + call assert_equal(0, &previewwindow) + + call s:goto_preview_and_close() +endfunc + +func Test_window_preview_terminal() + CheckFeature quickfix + " CheckFeature terminal + + " term ++curwin + term + const buf_num = bufnr('$') + call assert_equal(1, winnr('$')) + exe 'pbuffer' . buf_num + call assert_equal(2, winnr('$')) + call assert_equal(0, &previewwindow) + + call s:goto_preview_and_close() endfunc func Test_window_preview_from_help() |