aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_autocmd.vim10
-rw-r--r--test/old/testdir/test_bufwintabinfo.vim7
-rw-r--r--test/old/testdir/test_edit.vim2
-rw-r--r--test/old/testdir/test_execute_func.vim2
-rw-r--r--test/old/testdir/test_filter_cmd.vim4
-rw-r--r--test/old/testdir/test_makeencoding.vim2
-rw-r--r--test/old/testdir/test_mksession.vim181
-rw-r--r--test/old/testdir/test_normal.vim2
-rw-r--r--test/old/testdir/test_popup.vim20
-rw-r--r--test/old/testdir/test_tabpage.vim4
-rw-r--r--test/old/testdir/test_window_cmd.vim2
11 files changed, 222 insertions, 14 deletions
diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim
index cce60e9923..c2f7dbd28d 100644
--- a/test/old/testdir/test_autocmd.vim
+++ b/test/old/testdir/test_autocmd.vim
@@ -2548,7 +2548,13 @@ func Test_Changed_FirstTime()
let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})
call assert_equal('running', term_getstatus(buf))
" Wait for the ruler (in the status line) to be shown.
- call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))})
+ " In ConPTY, there is additional character which is drawn up to the width of
+ " the screen.
+ if has('conpty')
+ call WaitForAssert({-> assert_match('\<All.*$', term_getline(buf, 3))})
+ else
+ call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))})
+ endif
" It's only adding autocmd, so that no event occurs.
call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>")
call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>")
@@ -3022,6 +3028,8 @@ func Test_autocmd_CmdWinEnter()
endfunc
func Test_autocmd_was_using_freed_memory()
+ CheckFeature quickfix
+
pedit xx
n x
augroup winenter
diff --git a/test/old/testdir/test_bufwintabinfo.vim b/test/old/testdir/test_bufwintabinfo.vim
index 63f4fe6bb0..57492e07c9 100644
--- a/test/old/testdir/test_bufwintabinfo.vim
+++ b/test/old/testdir/test_bufwintabinfo.vim
@@ -1,6 +1,9 @@
" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
+source check.vim
+
+func Test_getbufwintabinfo()
+ CheckFeature quickfix
-function Test_getbufwintabinfo()
edit Xtestfile1
edit Xtestfile2
let buflist = getbufinfo()
@@ -109,7 +112,7 @@ function Test_getbufwintabinfo()
call assert_true(winlist[2].quickfix)
call assert_false(winlist[2].loclist)
wincmd t | only
-endfunction
+endfunc
function Test_get_buf_options()
let opts = bufnr()->getbufvar('&')
diff --git a/test/old/testdir/test_edit.vim b/test/old/testdir/test_edit.vim
index a0bc38a8fc..3fe65832c9 100644
--- a/test/old/testdir/test_edit.vim
+++ b/test/old/testdir/test_edit.vim
@@ -1137,6 +1137,8 @@ func Test_edit_CTRL_V()
endfunc
func Test_edit_F1()
+ CheckFeature quickfix
+
" Pressing <f1>
new
" call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix')
diff --git a/test/old/testdir/test_execute_func.vim b/test/old/testdir/test_execute_func.vim
index 61971ec587..2edae39b8f 100644
--- a/test/old/testdir/test_execute_func.vim
+++ b/test/old/testdir/test_execute_func.vim
@@ -124,6 +124,8 @@ func Test_win_execute()
endfunc
func Test_win_execute_update_ruler()
+ CheckFeature quickfix
+
enew
call setline(1, range(500))
20
diff --git a/test/old/testdir/test_filter_cmd.vim b/test/old/testdir/test_filter_cmd.vim
index dae164b11c..b84081e384 100644
--- a/test/old/testdir/test_filter_cmd.vim
+++ b/test/old/testdir/test_filter_cmd.vim
@@ -1,5 +1,7 @@
" Test the :filter command modifier
+source check.vim
+
func Test_filter()
edit Xdoesnotmatch
edit Xwillmatch
@@ -97,6 +99,8 @@ func Test_filter_cmd_with_filter()
endfunction
func Test_filter_commands()
+ CheckFeature quickfix
+
let g:test_filter_a = 1
let b:test_filter_b = 2
let test_filter_c = 3
diff --git a/test/old/testdir/test_makeencoding.vim b/test/old/testdir/test_makeencoding.vim
index e297bdc228..0a49fba755 100644
--- a/test/old/testdir/test_makeencoding.vim
+++ b/test/old/testdir/test_makeencoding.vim
@@ -1,7 +1,9 @@
" Tests for 'makeencoding'.
source shared.vim
+source check.vim
+CheckFeature quickfix
let s:python = PythonProg()
if s:python == ''
throw 'Skipped: python program missing'
diff --git a/test/old/testdir/test_mksession.vim b/test/old/testdir/test_mksession.vim
index 369929e3a0..d63d10b44c 100644
--- a/test/old/testdir/test_mksession.vim
+++ b/test/old/testdir/test_mksession.vim
@@ -257,6 +257,48 @@ func Test_mksession_lcd_multiple_tabs()
call delete('Xtest_mks.out')
endfunc
+" Test for tabpage-local directory
+func Test_mksession_tcd_multiple_tabs()
+ let save_cwd = getcwd()
+ call mkdir('Xtopdir')
+ cd Xtopdir
+ call mkdir('Xtabdir1')
+ call mkdir('Xtabdir2')
+ call mkdir('Xtabdir3')
+ call mkdir('Xwindir1')
+ call mkdir('Xwindir2')
+ call mkdir('Xwindir3')
+ tcd Xtabdir1
+ botright new
+ wincmd t
+ lcd ../Xwindir1
+ tabnew
+ tcd ../Xtabdir2
+ botright new
+ lcd ../Xwindir2
+ tabnew
+ tcd ../Xtabdir3
+ botright new
+ lcd ../Xwindir3
+ tabfirst
+ 1wincmd w
+ mksession! Xtest_mks.out
+ only | tabonly
+ source Xtest_mks.out
+ call assert_equal('Xtabdir1', fnamemodify(getcwd(-1, 1), ':t'))
+ call assert_equal('Xwindir1', fnamemodify(getcwd(1, 1), ':t'))
+ call assert_equal('Xtabdir1', fnamemodify(getcwd(2, 1), ':t'))
+ call assert_equal('Xtabdir2', fnamemodify(getcwd(-1, 2), ':t'))
+ call assert_equal('Xtabdir2', fnamemodify(getcwd(1, 2), ':t'))
+ call assert_equal('Xwindir2', fnamemodify(getcwd(2, 2), ':t'))
+ call assert_equal('Xtabdir3', fnamemodify(getcwd(-1, 3), ':t'))
+ call assert_equal('Xtabdir3', fnamemodify(getcwd(1, 3), ':t'))
+ call assert_equal('Xwindir3', fnamemodify(getcwd(2, 3), ':t'))
+ %bwipe
+ call chdir(save_cwd)
+ call delete("Xtopdir", "rf")
+endfunc
+
func Test_mksession_blank_tabs()
tabnew
tabnew
@@ -353,6 +395,112 @@ func Test_mksession_blank_windows()
call delete('Xtest_mks.out')
endfunc
+if has('terminal')
+
+func Test_mksession_terminal_shell()
+ CheckFeature quickfix
+
+ terminal
+ mksession! Xtest_mks.out
+ let lines = readfile('Xtest_mks.out')
+ let term_cmd = ''
+ for line in lines
+ if line =~ '^terminal'
+ let term_cmd = line
+ elseif line =~ 'badd.*' . &shell
+ call assert_report('unexpected shell line: ' . line)
+ endif
+ endfor
+ call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+\s*.*$', term_cmd)
+
+ call StopShellInTerminal(bufnr('%'))
+ call delete('Xtest_mks.out')
+endfunc
+
+func Test_mksession_terminal_no_restore_cmdarg()
+ terminal ++norestore
+ mksession! Xtest_mks.out
+ let lines = readfile('Xtest_mks.out')
+ let term_cmd = ''
+ for line in lines
+ if line =~ '^terminal'
+ call assert_report('session must not restore terminal')
+ endif
+ endfor
+
+ call StopShellInTerminal(bufnr('%'))
+ call delete('Xtest_mks.out')
+endfunc
+
+func Test_mksession_terminal_no_restore_funcarg()
+ call term_start(&shell, {'norestore': 1})
+ mksession! Xtest_mks.out
+ let lines = readfile('Xtest_mks.out')
+ let term_cmd = ''
+ for line in lines
+ if line =~ '^terminal'
+ call assert_report('session must not restore terminal')
+ endif
+ endfor
+
+ call StopShellInTerminal(bufnr('%'))
+ call delete('Xtest_mks.out')
+endfunc
+
+func Test_mksession_terminal_no_restore_func()
+ terminal
+ call term_setrestore(bufnr('%'), 'NONE')
+ mksession! Xtest_mks.out
+ let lines = readfile('Xtest_mks.out')
+ let term_cmd = ''
+ for line in lines
+ if line =~ '^terminal'
+ call assert_report('session must not restore terminal')
+ endif
+ endfor
+
+ call StopShellInTerminal(bufnr('%'))
+ call delete('Xtest_mks.out')
+endfunc
+
+func Test_mksession_terminal_no_ssop()
+ terminal
+ set sessionoptions-=terminal
+ mksession! Xtest_mks.out
+ let lines = readfile('Xtest_mks.out')
+ let term_cmd = ''
+ for line in lines
+ if line =~ '^terminal'
+ call assert_report('session must not restore terminal')
+ endif
+ endfor
+
+ call StopShellInTerminal(bufnr('%'))
+ call delete('Xtest_mks.out')
+ set sessionoptions&
+endfunc
+
+func Test_mksession_terminal_restore_other()
+ CheckFeature quickfix
+
+ terminal
+ eval bufnr('%')->term_setrestore('other')
+ mksession! Xtest_mks.out
+ let lines = readfile('Xtest_mks.out')
+ let term_cmd = ''
+ for line in lines
+ if line =~ '^terminal'
+ let term_cmd = line
+ endif
+ endfor
+ call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+.*other', term_cmd)
+
+ call StopShellInTerminal(bufnr('%'))
+ call delete('Xtest_mks.out')
+endfunc
+
+endif " has('terminal')
+
func Test_mkview_open_folds()
enew!
@@ -637,6 +785,7 @@ endfunc
" Test for changing directory to the session file directory
func Test_mksession_sesdir()
+ let save_cwd = getcwd()
call mkdir('Xproj')
mksession! Xproj/Xtest_mks1.out
set sessionoptions-=curdir
@@ -647,12 +796,42 @@ func Test_mksession_sesdir()
call assert_equal('testdir', fnamemodify(getcwd(), ':t'))
source Xproj/Xtest_mks2.out
call assert_equal('Xproj', fnamemodify(getcwd(), ':t'))
- cd ..
+ call chdir(save_cwd)
+ %bwipe
set sessionoptions&
call delete('Xproj', 'rf')
endfunc
+" Test for saving and restoring the tab-local working directory when there is
+" only a single tab and 'tabpages' is not in 'sessionoptions'.
+func Test_mksession_tcd_single_tabs()
+ only | tabonly
+
+ let save_cwd = getcwd()
+ set sessionoptions-=tabpages
+ set sessionoptions+=curdir
+ call mkdir('Xtopdir1')
+ call mkdir('Xtopdir2')
+
+ " There are two tab pages, the current one has local cwd set to 'Xtopdir2'.
+ exec 'tcd ' .. save_cwd .. '/Xtopdir1'
+ tabnew
+ exec 'tcd ' .. save_cwd .. '/Xtopdir2'
+ mksession! Xtest_tcd_single
+
+ source Xtest_tcd_single
+ " call assert_equal(2, haslocaldir())
+ call assert_equal(1, haslocaldir(-1))
+ call assert_equal('Xtopdir2', fnamemodify(getcwd(-1, 0), ':t'))
+ %bwipe
+
+ set sessionoptions&
+ call chdir(save_cwd)
+ call delete('Xtopdir1', 'rf')
+ call delete('Xtopdir2', 'rf')
+endfunc
+
" Test for storing the 'lines' and 'columns' settings
func Test_mksession_resize()
mksession! Xtest_mks1.out
diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim
index 09d3f0432f..f5ef2cc4ca 100644
--- a/test/old/testdir/test_normal.vim
+++ b/test/old/testdir/test_normal.vim
@@ -1923,6 +1923,8 @@ func Test_normal24_rot13()
endfunc
func Test_normal25_tag()
+ CheckFeature quickfix
+
" Testing for CTRL-] g CTRL-] g]
" CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-]
h
diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim
index 0ff7d67c9f..fa0df77ab5 100644
--- a/test/old/testdir/test_popup.vim
+++ b/test/old/testdir/test_popup.vim
@@ -501,6 +501,8 @@ endfunc
" Test that 'completefunc' on Scratch buffer with preview window works when
" it's OK.
func Test_completefunc_with_scratch_buffer()
+ CheckFeature quickfix
+
new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
set completeopt+=preview
setlocal completefunc=DummyCompleteFive
@@ -710,14 +712,13 @@ func Test_popup_and_window_resize()
endfunc
func Test_popup_and_preview_autocommand()
- " This used to crash Vim
- if !has('python')
- return
- endif
- let h = winheight(0)
- if h < 15
- return
+ CheckFeature python
+ CheckFeature quickfix
+ if winheight(0) < 15
+ throw 'Skipped: window height insufficient'
endif
+
+ " This used to crash Vim
new
augroup MyBufAdd
au!
@@ -821,9 +822,8 @@ func Test_balloon_split()
endfunc
func Test_popup_position()
- if !CanRunVimInTerminal()
- return
- endif
+ CheckScreendump
+
let lines =<< trim END
123456789_123456789_123456789_a
123456789_123456789_123456789_b
diff --git a/test/old/testdir/test_tabpage.vim b/test/old/testdir/test_tabpage.vim
index 9d1d37b862..4e7b09b9e7 100644
--- a/test/old/testdir/test_tabpage.vim
+++ b/test/old/testdir/test_tabpage.vim
@@ -4,6 +4,8 @@ source screendump.vim
source check.vim
function Test_tabpage()
+ CheckFeature quickfix
+
bw!
" Simple test for opening and closing a tab page
tabnew
@@ -273,6 +275,8 @@ function Test_tabpage_with_autocmd_tab_drop()
endfunction
function Test_tabpage_with_tab_modifier()
+ CheckFeature quickfix
+
for n in range(4)
tabedit
endfor
diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim
index bd4cb44b2b..152d1bacc7 100644
--- a/test/old/testdir/test_window_cmd.vim
+++ b/test/old/testdir/test_window_cmd.vim
@@ -508,6 +508,8 @@ func Test_equalalways_on_close()
endfunc
func Test_win_screenpos()
+ CheckFeature quickfix
+
call assert_equal(1, winnr('$'))
split
vsplit