summaryrefslogtreecommitdiff
path: root/src/testdir/test_tabpage.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-26 20:41:39 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-26 20:41:39 +0200
commit5d3c9f8c2a0fc29ba4ac8e0f052378b64d9e3dd3 (patch)
treecc1bf4386ae5f77819edd0ec2ba966deaf91e267 /src/testdir/test_tabpage.vim
parent5f36d5fbb836e6fdeb9e3b2c26edb88e45150db4 (diff)
downloadvim-git-5d3c9f8c2a0fc29ba4ac8e0f052378b64d9e3dd3.tar.gz
patch 8.2.1061: insufficient testing for src/window.cv8.2.1061
Problem: Insufficient testing for src/window.c. Solution: Add more tests. (Yegappan Lakshmanan, closes #6345)
Diffstat (limited to 'src/testdir/test_tabpage.vim')
-rw-r--r--src/testdir/test_tabpage.vim65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim
index d1bea2f3c..895716501 100644
--- a/src/testdir/test_tabpage.vim
+++ b/src/testdir/test_tabpage.vim
@@ -143,6 +143,8 @@ function Test_tabpage()
call assert_fails("tabmove $3", 'E474:')
call assert_fails("%tabonly", 'E16:')
1tabonly!
+ tabmove 1
+ call assert_equal(1, tabpagenr())
tabnew
call assert_fails("-2tabmove", 'E474:')
tabonly!
@@ -712,4 +714,67 @@ func Test_tabline_tabmenu()
%bw!
endfunc
+" Test for changing the current tab page from an autocmd when closing a tab
+" page.
+func Test_tabpage_switchtab_on_close()
+ only
+ tabnew
+ tabnew
+ " Test for BufLeave
+ augroup T1
+ au!
+ au BufLeave * tabfirst
+ augroup END
+ tabclose
+ call assert_equal(1, tabpagenr())
+ augroup T1
+ au!
+ augroup END
+
+ " Test for WinLeave
+ $tabnew
+ augroup T1
+ au!
+ au WinLeave * tabfirst
+ augroup END
+ tabclose
+ call assert_equal(1, tabpagenr())
+ augroup T1
+ au!
+ augroup END
+
+ " Test for TabLeave
+ $tabnew
+ augroup T1
+ au!
+ au TabLeave * tabfirst
+ augroup END
+ tabclose
+ call assert_equal(1, tabpagenr())
+ augroup T1
+ au!
+ augroup END
+ augroup! T1
+ tabonly
+endfunc
+
+" Test for closing the destination tabpage when jumping from one to another.
+func Test_tabpage_close_on_switch()
+ tabnew
+ tabnew
+ edit Xfile
+ augroup T2
+ au!
+ au BufLeave Xfile 1tabclose
+ augroup END
+ tabfirst
+ call assert_equal(2, tabpagenr())
+ call assert_equal('Xfile', @%)
+ augroup T2
+ au!
+ augroup END
+ augroup! T2
+ %bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab