aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir/test_preview.vim
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2025-02-05 23:09:29 +0000
committerJosh Rahm <joshuarahm@gmail.com>2025-02-05 23:09:29 +0000
commitd5f194ce780c95821a855aca3c19426576d28ae0 (patch)
treed45f461b19f9118ad2bb1f440a7a08973ad18832 /test/old/testdir/test_preview.vim
parentc5d770d311841ea5230426cc4c868e8db27300a8 (diff)
parent44740e561fc93afe3ebecfd3618bda2d2abeafb0 (diff)
downloadrneovim-rahm.tar.gz
rneovim-rahm.tar.bz2
rneovim-rahm.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309HEADrahm
Diffstat (limited to 'test/old/testdir/test_preview.vim')
-rw-r--r--test/old/testdir/test_preview.vim59
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()