aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_options.vim8
-rw-r--r--test/old/testdir/test_tabpage.vim58
2 files changed, 64 insertions, 2 deletions
diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim
index f7eace59c2..26b4f64487 100644
--- a/test/old/testdir/test_options.vim
+++ b/test/old/testdir/test_options.vim
@@ -558,6 +558,9 @@ func Test_set_completion_string_values()
" call assert_equal('sync', getcompletion('set swapsync=', 'cmdline')[1])
call assert_equal('usetab', getcompletion('set switchbuf=', 'cmdline')[1])
call assert_equal('ignore', getcompletion('set tagcase=', 'cmdline')[1])
+ if exists('+tabclose')
+ call assert_equal('left uselast', join(sort(getcompletion('set tabclose=', 'cmdline'))), ' ')
+ endif
if exists('+termwintype')
call assert_equal('conpty', getcompletion('set termwintype=', 'cmdline')[1])
endif
@@ -1377,9 +1380,10 @@ func Test_write()
new
call setline(1, ['L1'])
set nowrite
- call assert_fails('write Xfile', 'E142:')
+ call assert_fails('write Xwrfile', 'E142:')
set write
- close!
+ " close swapfile
+ bw!
endfunc
" Test for 'buftype' option
diff --git a/test/old/testdir/test_tabpage.vim b/test/old/testdir/test_tabpage.vim
index 2bd2907a55..482da2de7f 100644
--- a/test/old/testdir/test_tabpage.vim
+++ b/test/old/testdir/test_tabpage.vim
@@ -967,6 +967,64 @@ func Test_tabpage_alloc_failure()
call assert_equal(1, tabpagenr('$'))
endfunc
+func Test_tabpage_tabclose()
+ " Default behaviour, move to the right.
+ call s:reconstruct_tabpage_for_test(6)
+ norm! 4gt
+ setl tcl=
+ tabclose
+ call assert_equal("n3", bufname())
+
+ " Move to the left.
+ call s:reconstruct_tabpage_for_test(6)
+ norm! 4gt
+ setl tcl=left
+ tabclose
+ call assert_equal("n1", bufname())
+
+ " Move to the last used tab page.
+ call s:reconstruct_tabpage_for_test(6)
+ norm! 5gt
+ norm! 2gt
+ setl tcl=uselast
+ tabclose
+ call assert_equal("n3", bufname())
+
+ " Same, but the last used tab page is invalid. Move to the right.
+ call s:reconstruct_tabpage_for_test(6)
+ norm! 5gt
+ norm! 3gt
+ setl tcl=uselast
+ tabclose 5
+ tabclose!
+ call assert_equal("n2", bufname())
+
+ " Same, but the last used tab page is invalid. Move to the left.
+ call s:reconstruct_tabpage_for_test(6)
+ norm! 5gt
+ norm! 3gt
+ setl tcl=uselast,left
+ tabclose 5
+ tabclose!
+ call assert_equal("n0", bufname())
+
+ " Move left when moving right is not possible.
+ call s:reconstruct_tabpage_for_test(6)
+ setl tcl=
+ norm! 6gt
+ tabclose
+ call assert_equal("n3", bufname())
+
+ " Move right when moving left is not possible.
+ call s:reconstruct_tabpage_for_test(6)
+ setl tcl=left
+ norm! 1gt
+ tabclose
+ call assert_equal("n0", bufname())
+
+ setl tcl&
+endfunc
+
" this was giving ml_get errors
func Test_tabpage_last_line()
enew