aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_window_cmd.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-28 21:55:55 +0800
committerGitHub <noreply@github.com>2023-02-28 21:55:55 +0800
commitf289fc4abb8e7c02acfd2dfc834cc6447193a67e (patch)
tree4790d7d0eb363611d524dad5b09e2687bec2a1ec /src/nvim/testdir/test_window_cmd.vim
parentfaa5d5be4b998427b3378d16ea5ce6ef6f5ddfd0 (diff)
parent278aeee3aed753d1084597378e653395bd472c42 (diff)
downloadrneovim-f289fc4abb8e7c02acfd2dfc834cc6447193a67e.tar.gz
rneovim-f289fc4abb8e7c02acfd2dfc834cc6447193a67e.tar.bz2
rneovim-f289fc4abb8e7c02acfd2dfc834cc6447193a67e.zip
Merge pull request #22456 from zeertzjq/vim-9.0.0430
vim-patch:8.2.{4668,4670},9.0.0430: cannot use repeat() with a blob
Diffstat (limited to 'src/nvim/testdir/test_window_cmd.vim')
-rw-r--r--src/nvim/testdir/test_window_cmd.vim46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index 8b9457ae1d..34614832a9 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -1525,6 +1525,52 @@ func Test_win_move_statusline()
%bwipe!
endfunc
+" Test for window allocation failure
+func Test_window_alloc_failure()
+ CheckFunction test_alloc_fail
+ %bw!
+
+ " test for creating a new window above current window
+ call test_alloc_fail(GetAllocId('newwin_wvars'), 0, 0)
+ call assert_fails('above new', 'E342:')
+ call assert_equal(1, winnr('$'))
+
+ " test for creating a new window below current window
+ call test_alloc_fail(GetAllocId('newwin_wvars'), 0, 0)
+ call assert_fails('below new', 'E342:')
+ call assert_equal(1, winnr('$'))
+
+ " test for popup window creation failure
+ call test_alloc_fail(GetAllocId('newwin_wvars'), 0, 0)
+ call assert_fails('call popup_create("Hello", {})', 'E342:')
+ call assert_equal([], popup_list())
+
+ call test_alloc_fail(GetAllocId('newwin_wvars'), 0, 0)
+ call assert_fails('split', 'E342:')
+ call assert_equal(1, winnr('$'))
+
+ edit Xfile1
+ edit Xfile2
+ call test_alloc_fail(GetAllocId('newwin_wvars'), 0, 0)
+ call assert_fails('sb Xfile1', 'E342:')
+ call assert_equal(1, winnr('$'))
+ call assert_equal('Xfile2', @%)
+ %bw!
+
+ " FIXME: The following test crashes Vim
+ " test for new tabpage creation failure
+ " call test_alloc_fail(GetAllocId('newwin_wvars'), 0, 0)
+ " call assert_fails('tabnew', 'E342:')
+ " call assert_equal(1, tabpagenr('$'))
+ " call assert_equal(1, winnr('$'))
+
+ " This test messes up the internal Vim window/frame information. So the
+ " Test_window_cmd_cmdwin_with_vsp() test fails after running this test.
+ " Open a new tab and close everything else to fix this issue.
+ tabnew
+ tabonly
+endfunc
+
func Test_win_equal_last_status()
let save_lines = &lines
set lines=20