diff options
Diffstat (limited to 'src/testdir/test_window_cmd.vim')
-rw-r--r-- | src/testdir/test_window_cmd.vim | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index 19b4466b93..47988b201a 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -1512,5 +1512,49 @@ func Test_win_move_statusline() %bwipe! endfunc +" Test for window allocation failure +func Test_window_alloc_failure() + %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 " vim: shiftwidth=2 sts=2 expandtab |