1
0
forked from aniani/vim

patch 9.0.0418: manually deleting temp test files

Problem:    Manually deleting temp test files.
Solution:   Use the 'D' flag of writefile() and mkdir().
This commit is contained in:
Bram Moolenaar
2022-09-08 16:39:22 +01:00
parent 2a4c885d54
commit 45bbaef038
11 changed files with 85 additions and 162 deletions

View File

@@ -58,18 +58,17 @@ func Test_cd_minus()
call writefile(v:errors, 'Xresult') call writefile(v:errors, 'Xresult')
qall! qall!
[SCRIPT] [SCRIPT]
call writefile(lines, 'Xscript') call writefile(lines, 'Xscript', 'D')
if RunVim([], [], '--clean -S Xscript') if RunVim([], [], '--clean -S Xscript')
call assert_equal([], readfile('Xresult')) call assert_equal([], readfile('Xresult'))
endif endif
call delete('Xscript')
call delete('Xresult') call delete('Xresult')
endfunc endfunc
" Test for chdir() " Test for chdir()
func Test_chdir_func() func Test_chdir_func()
let topdir = getcwd() let topdir = getcwd()
call mkdir('Xchdir/y/z', 'p') call mkdir('Xchdir/y/z', 'pR')
" Create a few tabpages and windows with different directories " Create a few tabpages and windows with different directories
new new
@@ -110,13 +109,12 @@ func Test_chdir_func()
only | tabonly only | tabonly
call chdir(topdir) call chdir(topdir)
call delete('Xchdir', 'rf')
endfunc endfunc
" Test for changing to the previous directory '-' " Test for changing to the previous directory '-'
func Test_prev_dir() func Test_prev_dir()
let topdir = getcwd() let topdir = getcwd()
call mkdir('Xprevdir/a/b/c', 'p') call mkdir('Xprevdir/a/b/c', 'pR')
" Create a few tabpages and windows with different directories " Create a few tabpages and windows with different directories
new | only new | only
@@ -173,7 +171,6 @@ func Test_prev_dir()
only | tabonly only | tabonly
call chdir(topdir) call chdir(topdir)
call delete('Xprevdir', 'rf')
endfunc endfunc
func Test_lcd_split() func Test_lcd_split()
@@ -201,22 +198,18 @@ func Test_cd_from_non_existing_dir()
endfunc endfunc
func Test_cd_completion() func Test_cd_completion()
call mkdir('XComplDir1', 'p') call mkdir('XComplDir1', 'D')
call mkdir('XComplDir2', 'p') call mkdir('XComplDir2', 'D')
call writefile([], 'XComplFile') call writefile([], 'XComplFile', 'D')
for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir'] for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir']
call feedkeys(':' .. cmd .. " XCompl\<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(':' .. cmd .. " XCompl\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/', @:) call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/', @:)
endfor endfor
call delete('XComplDir1', 'd')
call delete('XComplDir2', 'd')
call delete('XComplFile')
endfunc endfunc
func Test_cd_unknown_dir() func Test_cd_unknown_dir()
call mkdir('Xa') call mkdir('Xa', 'R')
cd Xa cd Xa
call writefile(['text'], 'Xb.txt') call writefile(['text'], 'Xb.txt')
edit Xa/Xb.txt edit Xa/Xb.txt
@@ -229,14 +222,13 @@ func Test_cd_unknown_dir()
bwipe! bwipe!
exe "bwipe! " .. first_buf exe "bwipe! " .. first_buf
call delete('Xa', 'rf')
endfunc endfunc
func Test_getcwd_actual_dir() func Test_getcwd_actual_dir()
CheckOption autochdir CheckOption autochdir
let startdir = getcwd() let startdir = getcwd()
call mkdir('Xactual') call mkdir('Xactual', 'R')
call test_autochdir() call test_autochdir()
set autochdir set autochdir
edit Xactual/file.txt edit Xactual/file.txt
@@ -250,7 +242,6 @@ func Test_getcwd_actual_dir()
set noautochdir set noautochdir
bwipe! bwipe!
call chdir(startdir) call chdir(startdir)
call delete('Xactual', 'rf')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -64,8 +64,8 @@ func Test_getchangelist()
call assert_equal([], 10->getchangelist()) call assert_equal([], 10->getchangelist())
call assert_equal([[], 0], getchangelist()) call assert_equal([[], 0], getchangelist())
call writefile(['line1', 'line2', 'line3'], 'Xclistfile1.txt') call writefile(['line1', 'line2', 'line3'], 'Xclistfile1.txt', 'D')
call writefile(['line1', 'line2', 'line3'], 'Xclistfile2.txt') call writefile(['line1', 'line2', 'line3'], 'Xclistfile2.txt', 'D')
edit Xclistfile1.txt edit Xclistfile1.txt
let buf_1 = bufnr() let buf_1 = bufnr()
@@ -100,8 +100,6 @@ func Test_getchangelist()
\ getchangelist(buf_2)) \ getchangelist(buf_2))
bwipe! bwipe!
call delete('Xclistfile1.txt')
call delete('Xclistfile2.txt')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -714,7 +714,7 @@ func Stop_g_job()
endfunc endfunc
func Test_nl_read_file() func Test_nl_read_file()
call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput') call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput', 'D')
let g:job = job_start(s:python . " test_channel_pipe.py", let g:job = job_start(s:python . " test_channel_pipe.py",
\ {'in_io': 'file', 'in_name': 'Xinput'}) \ {'in_io': 'file', 'in_name': 'Xinput'})
call assert_equal("run", job_status(g:job)) call assert_equal("run", job_status(g:job))
@@ -726,7 +726,6 @@ func Test_nl_read_file()
call assert_equal("AND this", ch_readraw(handle)) call assert_equal("AND this", ch_readraw(handle))
finally finally
call Stop_g_job() call Stop_g_job()
call delete('Xinput')
endtry endtry
call assert_fails("echo ch_read(test_null_channel(), {'callback' : 'abc'})", 'E475:') call assert_fails("echo ch_read(test_null_channel(), {'callback' : 'abc'})", 'E475:')
endfunc endfunc
@@ -1161,14 +1160,13 @@ func Test_write_to_buffer_and_scroll()
endif endif
call job_start(cmd, #{out_io: 'buffer', out_name: 'Xscrollbuffer'}) call job_start(cmd, #{out_io: 'buffer', out_name: 'Xscrollbuffer'})
END END
call writefile(lines, 'XtestBufferScroll') call writefile(lines, 'XtestBufferScroll', 'D')
let buf = RunVimInTerminal('-S XtestBufferScroll', #{rows: 10}) let buf = RunVimInTerminal('-S XtestBufferScroll', #{rows: 10})
call TermWait(buf, 50) call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_job_buffer_scroll_1', {}) call VerifyScreenDump(buf, 'Test_job_buffer_scroll_1', {})
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestBufferScroll')
endfunc endfunc
func Test_pipe_null() func Test_pipe_null()
@@ -2178,7 +2176,7 @@ endfunc
func Test_job_tty_in_out() func Test_job_tty_in_out()
CheckUnix CheckUnix
call writefile(['test'], 'Xtestin') call writefile(['test'], 'Xtestin', 'D')
let in_opts = [{}, let in_opts = [{},
\ {'in_io': 'null'}, \ {'in_io': 'null'},
\ {'in_io': 'file', 'in_name': 'Xtestin'}] \ {'in_io': 'file', 'in_name': 'Xtestin'}]
@@ -2220,7 +2218,6 @@ func Test_job_tty_in_out()
call WaitForAssert({-> assert_equal('dead', job_status(job))}) call WaitForAssert({-> assert_equal('dead', job_status(job))})
endfor endfor
call delete('Xtestin')
call delete('Xtestout') call delete('Xtestout')
call delete('Xtesterr') call delete('Xtesterr')
endfunc endfunc
@@ -2281,9 +2278,9 @@ func Test_zz_ch_log()
let text = readfile('Xlog') let text = readfile('Xlog')
call assert_match("hello there", text[1]) call assert_match("hello there", text[1])
call assert_match("%s%s", text[2]) call assert_match("%s%s", text[2])
call mkdir("Xchlogdir1") call mkdir("Xchlogdir1", 'D')
call assert_fails("call ch_logfile('Xchlogdir1')", 'E484:') call assert_fails("call ch_logfile('Xchlogdir1')", 'E484:')
cal delete("Xchlogdir1", 'd')
call delete('Xlog') call delete('Xlog')
endfunc endfunc

View File

@@ -2,7 +2,7 @@
" Test for 'include' without \zs or \ze " Test for 'include' without \zs or \ze
func Test_checkpath1() func Test_checkpath1()
call mkdir("Xcheckdir1/dir2", "p") call mkdir("Xcheckdir1/dir2", "pR")
call writefile(['#include "bar.a"'], 'Xcheckdir1/dir2/foo.a') call writefile(['#include "bar.a"'], 'Xcheckdir1/dir2/foo.a')
call writefile(['#include "baz.a"'], 'Xcheckdir1/dir2/bar.a') call writefile(['#include "baz.a"'], 'Xcheckdir1/dir2/bar.a')
call writefile(['#include "foo.a"'], 'Xcheckdir1/dir2/baz.a') call writefile(['#include "foo.a"'], 'Xcheckdir1/dir2/baz.a')
@@ -23,7 +23,6 @@ func Test_checkpath1()
enew enew
call delete("./Xbase.a") call delete("./Xbase.a")
call delete("Xcheckdir1", "rf")
set path& set path&
endfunc endfunc
@@ -33,11 +32,11 @@ endfunc
" Test for 'include' with \zs and \ze " Test for 'include' with \zs and \ze
func Test_checkpath2() func Test_checkpath2()
call mkdir("Xcheckdir2/dir2", "p") call mkdir("Xcheckdir2/dir2", "pR")
call writefile(['%inc /bar/'], 'Xcheckdir2/dir2/foo.b') call writefile(['%inc /bar/'], 'Xcheckdir2/dir2/foo.b')
call writefile(['%inc /baz/'], 'Xcheckdir2/dir2/bar.b') call writefile(['%inc /baz/'], 'Xcheckdir2/dir2/bar.b')
call writefile(['%inc /foo/'], 'Xcheckdir2/dir2/baz.b') call writefile(['%inc /foo/'], 'Xcheckdir2/dir2/baz.b')
call writefile(['%inc /foo/'], 'Xbase.b') call writefile(['%inc /foo/'], 'Xbase.b', 'D')
let &include='^\s*%inc\s*/\zs[^/]\+\ze' let &include='^\s*%inc\s*/\zs[^/]\+\ze'
let &includeexpr='DotsToSlashes()' let &includeexpr='DotsToSlashes()'
@@ -56,8 +55,6 @@ func Test_checkpath2()
\ ' foo (Already listed)'], res) \ ' foo (Already listed)'], res)
enew enew
call delete("./Xbase.b")
call delete("Xcheckdir2", "rf")
set path& set path&
set include& set include&
set includeexpr& set includeexpr&
@@ -72,12 +69,12 @@ endfunc
" Test for 'include' with \zs and no \ze " Test for 'include' with \zs and no \ze
func Test_checkpath3() func Test_checkpath3()
call mkdir("Xcheckdir3/dir2", "p") call mkdir("Xcheckdir3/dir2", "pR")
call writefile(['%inc bar.c'], 'Xcheckdir3/dir2/foo.c') call writefile(['%inc bar.c'], 'Xcheckdir3/dir2/foo.c')
call writefile(['%inc baz.c'], 'Xcheckdir3/dir2/bar.c') call writefile(['%inc baz.c'], 'Xcheckdir3/dir2/bar.c')
call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/baz.c') call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/baz.c')
call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/FALSE.c') call writefile(['%inc foo.c'], 'Xcheckdir3/dir2/FALSE.c')
call writefile(['%inc FALSE.c foo.c'], 'Xbase.c') call writefile(['%inc FALSE.c foo.c'], 'Xbase.c', 'D')
let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze'
let &includeexpr='StripNewlineChar()' let &includeexpr='StripNewlineChar()'
@@ -96,8 +93,6 @@ func Test_checkpath3()
\ ' foo.c (Already listed)'], res) \ ' foo.c (Already listed)'], res)
enew enew
call delete("./Xbase.c")
call delete("Xcheckdir3", "rf")
set path& set path&
set include& set include&
set includeexpr& set includeexpr&

View File

@@ -20,14 +20,13 @@ func TearDown()
endfunc endfunc
func Test_complete_tab() func Test_complete_tab()
call writefile(['testfile'], 'Xtestfile') call writefile(['testfile'], 'Xtestfile', 'D')
call feedkeys(":e Xtest\t\r", "tx") call feedkeys(":e Xtest\t\r", "tx")
call assert_equal('testfile', getline(1)) call assert_equal('testfile', getline(1))
" Pressing <Tab> after '%' completes the current file, also on MS-Windows " Pressing <Tab> after '%' completes the current file, also on MS-Windows
call feedkeys(":e %\t\r", "tx") call feedkeys(":e %\t\r", "tx")
call assert_equal('e Xtestfile', @:) call assert_equal('e Xtestfile', @:)
call delete('Xtestfile')
endfunc endfunc
func Test_complete_list() func Test_complete_list()
@@ -42,7 +41,7 @@ func Test_complete_list()
" Test for displaying the tail of the completion matches " Test for displaying the tail of the completion matches
set wildmode=longest,full set wildmode=longest,full
call mkdir('Xtest') call mkdir('Xtest', 'R')
call writefile([], 'Xtest/a.c') call writefile([], 'Xtest/a.c')
call writefile([], 'Xtest/a.h') call writefile([], 'Xtest/a.h')
let g:Sline = '' let g:Sline = ''
@@ -78,12 +77,11 @@ func Test_complete_list()
call assert_equal(':e Xtes[/', g:Sline) call assert_equal(':e Xtes[/', g:Sline)
call assert_equal('"e Xtes[/', @:) call assert_equal('"e Xtes[/', @:)
call delete('Xtest', 'rf')
set wildmode& set wildmode&
endfunc endfunc
func Test_complete_wildmenu() func Test_complete_wildmenu()
call mkdir('Xwilddir1/Xdir2', 'p') call mkdir('Xwilddir1/Xdir2', 'pR')
call writefile(['testfile1'], 'Xwilddir1/Xtestfile1') call writefile(['testfile1'], 'Xwilddir1/Xtestfile1')
call writefile(['testfile2'], 'Xwilddir1/Xtestfile2') call writefile(['testfile2'], 'Xwilddir1/Xtestfile2')
call writefile(['testfile3'], 'Xwilddir1/Xdir2/Xtestfile3') call writefile(['testfile3'], 'Xwilddir1/Xdir2/Xtestfile3')
@@ -162,7 +160,6 @@ func Test_complete_wildmenu()
" cleanup " cleanup
%bwipe %bwipe
call delete('Xwilddir1', 'rf')
set nowildmenu set nowildmenu
endfunc endfunc
@@ -172,7 +169,7 @@ func Test_wildmenu_screendump()
let lines =<< trim [SCRIPT] let lines =<< trim [SCRIPT]
set wildmenu hlsearch set wildmenu hlsearch
[SCRIPT] [SCRIPT]
call writefile(lines, 'XTest_wildmenu') call writefile(lines, 'XTest_wildmenu', 'D')
let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8}) let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8})
call term_sendkeys(buf, ":vim\<Tab>") call term_sendkeys(buf, ":vim\<Tab>")
@@ -190,7 +187,6 @@ func Test_wildmenu_screendump()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_wildmenu')
endfunc endfunc
func Test_redraw_in_autocmd() func Test_redraw_in_autocmd()
@@ -200,7 +196,7 @@ func Test_redraw_in_autocmd()
set cmdheight=2 set cmdheight=2
autocmd CmdlineChanged * redraw autocmd CmdlineChanged * redraw
END END
call writefile(lines, 'XTest_redraw') call writefile(lines, 'XTest_redraw', 'D')
let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8}) let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8})
call term_sendkeys(buf, ":for i in range(3)\<CR>") call term_sendkeys(buf, ":for i in range(3)\<CR>")
@@ -212,7 +208,6 @@ func Test_redraw_in_autocmd()
" clean up " clean up
call term_sendkeys(buf, "\<CR>") call term_sendkeys(buf, "\<CR>")
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_redraw')
endfunc endfunc
func Test_changing_cmdheight() func Test_changing_cmdheight()
@@ -221,7 +216,7 @@ func Test_changing_cmdheight()
let lines =<< trim END let lines =<< trim END
set cmdheight=1 laststatus=2 set cmdheight=1 laststatus=2
END END
call writefile(lines, 'XTest_cmdheight') call writefile(lines, 'XTest_cmdheight', 'D')
let buf = RunVimInTerminal('-S XTest_cmdheight', {'rows': 8}) let buf = RunVimInTerminal('-S XTest_cmdheight', {'rows': 8})
call term_sendkeys(buf, ":resize -3\<CR>") call term_sendkeys(buf, ":resize -3\<CR>")
@@ -246,7 +241,6 @@ func Test_changing_cmdheight()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_cmdheight')
endfunc endfunc
func Test_map_completion() func Test_map_completion()
@@ -455,10 +449,9 @@ func Test_getcompletion()
call assert_true(index(l, 'runtest.vim') < 0) call assert_true(index(l, 'runtest.vim') < 0)
set wildignore& set wildignore&
" Directory name with space character " Directory name with space character
call mkdir('Xdir with space') call mkdir('Xdir with space', 'D')
call assert_equal(['Xdir with space/'], getcompletion('Xdir\ w', 'shellcmd')) call assert_equal(['Xdir with space/'], getcompletion('Xdir\ w', 'shellcmd'))
call assert_equal(['./Xdir with space/'], getcompletion('./Xdir', 'shellcmd')) call assert_equal(['./Xdir with space/'], getcompletion('./Xdir', 'shellcmd'))
call delete('Xdir with space', 'd')
let l = getcompletion('ha', 'filetype') let l = getcompletion('ha', 'filetype')
call assert_true(index(l, 'hamster') >= 0) call assert_true(index(l, 'hamster') >= 0)
@@ -581,14 +574,13 @@ func Test_getcompletion()
endif endif
set tags=Xtags set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags') call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags', 'D')
for name in names for name in names
let matchcount = len(getcompletion('', name)) let matchcount = len(getcompletion('', name))
call assert_true(matchcount >= 0, 'No matches for ' . name) call assert_true(matchcount >= 0, 'No matches for ' . name)
endfor endfor
call delete('Xtags')
set tags& set tags&
edit a~b edit a~b
@@ -633,7 +625,7 @@ func Test_complete_autoload_error()
enddef enddef
echo this will cause an error echo this will cause an error
END END
call mkdir('Xdir/autoload', 'p') call mkdir('Xdir/autoload', 'pR')
call writefile(lines, 'Xdir/autoload/script.vim') call writefile(lines, 'Xdir/autoload/script.vim')
exe 'set rtp+=' .. getcwd() .. '/Xdir' exe 'set rtp+=' .. getcwd() .. '/Xdir'
@@ -647,7 +639,6 @@ func Test_complete_autoload_error()
call v9.CheckScriptFailure(lines, 'E121: Undefined variable: this') call v9.CheckScriptFailure(lines, 'E121: Undefined variable: this')
let &rtp = save_rtp let &rtp = save_rtp
call delete('Xdir', 'rf')
endfunc endfunc
func Test_fullcommand() func Test_fullcommand()
@@ -698,7 +689,7 @@ endfunc
func Test_shellcmd_completion() func Test_shellcmd_completion()
let save_path = $PATH let save_path = $PATH
call mkdir('Xpathdir/Xpathsubdir', 'p') call mkdir('Xpathdir/Xpathsubdir', 'pR')
call writefile([''], 'Xpathdir/Xfile.exe') call writefile([''], 'Xpathdir/Xfile.exe')
call setfperm('Xpathdir/Xfile.exe', 'rwx------') call setfperm('Xpathdir/Xfile.exe', 'rwx------')
@@ -714,17 +705,15 @@ func Test_shellcmd_completion()
call insert(expected, 'Xfile.exe') call insert(expected, 'Xfile.exe')
call assert_equal(expected, actual) call assert_equal(expected, actual)
call delete('Xpathdir', 'rf')
let $PATH = save_path let $PATH = save_path
endfunc endfunc
func Test_expand_star_star() func Test_expand_star_star()
call mkdir('a/b', 'p') call mkdir('a/b', 'pR')
call writefile(['asdfasdf'], 'a/b/fileXname') call writefile(['asdfasdf'], 'a/b/fileXname')
call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt') call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt')
call assert_equal('find a/b/fileXname', @:) call assert_equal('find a/b/fileXname', @:)
bwipe! bwipe!
call delete('a', 'rf')
endfunc endfunc
func Test_cmdline_paste() func Test_cmdline_paste()
@@ -832,14 +821,13 @@ func Test_illegal_address1()
endfunc endfunc
func Test_illegal_address2() func Test_illegal_address2()
call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim') call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim', 'D')
new new
source Xtest.vim source Xtest.vim
" Trigger calling validate_cursor() " Trigger calling validate_cursor()
diffsp Xtest.vim diffsp Xtest.vim
quit! quit!
bwipe! bwipe!
call delete('Xtest.vim')
endfunc endfunc
func Test_mark_from_line_zero() func Test_mark_from_line_zero()
@@ -1035,14 +1023,13 @@ func Test_cmdline_complete_various()
call assert_equal("\"sI \<C-A>", @:) call assert_equal("\"sI \<C-A>", @:)
" completion for :write command " completion for :write command
call mkdir('Xcwdir') call mkdir('Xcwdir', 'R')
call writefile(['one'], 'Xcwdir/Xfile1') call writefile(['one'], 'Xcwdir/Xfile1')
let save_cwd = getcwd() let save_cwd = getcwd()
cd Xcwdir cd Xcwdir
call feedkeys(":w >> \<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":w >> \<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal("\"w >> Xfile1", @:) call assert_equal("\"w >> Xfile1", @:)
call chdir(save_cwd) call chdir(save_cwd)
call delete('Xcwdir', 'rf')
" completion for :w ! and :r ! commands " completion for :w ! and :r ! commands
call feedkeys(":w !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":w !invalid_xyz_cmd\<C-A>\<C-B>\"\<CR>", 'xt')
@@ -1125,12 +1112,10 @@ func Test_cmdline_complete_various()
call assert_equal("\"doautocmd BufNew,BufEnter", @:) call assert_equal("\"doautocmd BufNew,BufEnter", @:)
" completion of file name in :doautocmd " completion of file name in :doautocmd
call writefile([], 'Xvarfile1') call writefile([], 'Xvarfile1', 'D')
call writefile([], 'Xvarfile2') call writefile([], 'Xvarfile2', 'D')
call feedkeys(":doautocmd BufEnter Xvarfi\<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":doautocmd BufEnter Xvarfi\<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal("\"doautocmd BufEnter Xvarfile1 Xvarfile2", @:) call assert_equal("\"doautocmd BufEnter Xvarfile1 Xvarfile2", @:)
call delete('Xvarfile1')
call delete('Xvarfile2')
" completion for the :augroup command " completion for the :augroup command
augroup XTest.test augroup XTest.test
@@ -1272,7 +1257,7 @@ endfunc
" Test for 'wildignorecase' " Test for 'wildignorecase'
func Test_cmdline_wildignorecase() func Test_cmdline_wildignorecase()
CheckUnix CheckUnix
call writefile([], 'XTEST') call writefile([], 'XTEST', 'D')
set wildignorecase set wildignorecase
call feedkeys(":e xt\<Tab>\<C-B>\"\<CR>", 'xt') call feedkeys(":e xt\<Tab>\<C-B>\"\<CR>", 'xt')
call assert_equal('"e XTEST', @:) call assert_equal('"e XTEST', @:)
@@ -1282,7 +1267,6 @@ func Test_cmdline_wildignorecase()
call assert_equal('"e xt', @:) call assert_equal('"e xt', @:)
call assert_equal('XTEST', g:Sline) call assert_equal('XTEST', g:Sline)
set wildignorecase& set wildignorecase&
call delete('XTEST')
endfunc endfunc
func Test_cmdline_write_alternatefile() func Test_cmdline_write_alternatefile()
@@ -1408,9 +1392,9 @@ func Test_verbosefile()
let log = readfile('Xlog') let log = readfile('Xlog')
call assert_match("foo\nbar", join(log, "\n")) call assert_match("foo\nbar", join(log, "\n"))
call delete('Xlog') call delete('Xlog')
call mkdir('Xdir')
call mkdir('Xdir', 'D')
call assert_fails('set verbosefile=Xdir', ['E484:.*Xdir', 'E474:']) call assert_fails('set verbosefile=Xdir', ['E484:.*Xdir', 'E474:'])
call delete('Xdir', 'd')
endfunc endfunc
func Test_verbose_option() func Test_verbose_option()
@@ -1421,7 +1405,7 @@ func Test_verbose_option()
call feedkeys("\r", 't') " for the hit-enter prompt call feedkeys("\r", 't') " for the hit-enter prompt
set verbose=20 set verbose=20
[SCRIPT] [SCRIPT]
call writefile(lines, 'XTest_verbose') call writefile(lines, 'XTest_verbose', 'D')
let buf = RunVimInTerminal('-S XTest_verbose', {'rows': 12}) let buf = RunVimInTerminal('-S XTest_verbose', {'rows': 12})
call TermWait(buf, 50) call TermWait(buf, 50)
@@ -1430,7 +1414,6 @@ func Test_verbose_option()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_verbose')
endfunc endfunc
func Test_setcmdpos() func Test_setcmdpos()
@@ -1533,7 +1516,7 @@ func Test_cmdlineclear_tabenter()
call setline(1, range(30)) call setline(1, range(30))
[SCRIPT] [SCRIPT]
call writefile(lines, 'XtestCmdlineClearTabenter') call writefile(lines, 'XtestCmdlineClearTabenter', 'D')
let buf = RunVimInTerminal('-S XtestCmdlineClearTabenter', #{rows: 10}) let buf = RunVimInTerminal('-S XtestCmdlineClearTabenter', #{rows: 10})
call TermWait(buf, 25) call TermWait(buf, 25)
" in one tab make the command line higher with CTRL-W - " in one tab make the command line higher with CTRL-W -
@@ -1541,7 +1524,6 @@ func Test_cmdlineclear_tabenter()
call VerifyScreenDump(buf, 'Test_cmdlineclear_tabenter', {}) call VerifyScreenDump(buf, 'Test_cmdlineclear_tabenter', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestCmdlineClearTabenter')
endfunc endfunc
" Test for expanding special keywords in cmdline " Test for expanding special keywords in cmdline
@@ -1552,14 +1534,12 @@ func Test_cmdline_expand_special()
call assert_fails('e <abuf>', 'E496:') call assert_fails('e <abuf>', 'E496:')
call assert_fails('e <amatch>', 'E497:') call assert_fails('e <amatch>', 'E497:')
call writefile([], 'Xfile.cpp') call writefile([], 'Xfile.cpp', 'D')
call writefile([], 'Xfile.java') call writefile([], 'Xfile.java', 'D')
new Xfile.cpp new Xfile.cpp
call feedkeys(":e %:r\<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":e %:r\<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal('"e Xfile.cpp Xfile.java', @:) call assert_equal('"e Xfile.cpp Xfile.java', @:)
close close
call delete('Xfile.cpp')
call delete('Xfile.java')
endfunc endfunc
" Test for backtick expression in the command line " Test for backtick expression in the command line
@@ -1593,11 +1573,10 @@ func Test_cmd_bang()
call delete('Xfile.out') call delete('Xfile.out')
qall! qall!
[SCRIPT] [SCRIPT]
call writefile(lines, 'Xscript') call writefile(lines, 'Xscript', 'D')
if RunVim([], [], '--clean -S Xscript') if RunVim([], [], '--clean -S Xscript')
call assert_equal([], readfile('Xresult')) call assert_equal([], readfile('Xresult'))
endif endif
call delete('Xscript')
call delete('Xresult') call delete('Xresult')
endfunc endfunc
@@ -1619,7 +1598,7 @@ endfunc
" Test for using ~ for home directory in cmdline completion matches " Test for using ~ for home directory in cmdline completion matches
func Test_cmdline_expand_home() func Test_cmdline_expand_home()
call mkdir('Xexpdir') call mkdir('Xexpdir', 'R')
call writefile([], 'Xexpdir/Xfile1') call writefile([], 'Xexpdir/Xfile1')
call writefile([], 'Xexpdir/Xfile2') call writefile([], 'Xexpdir/Xfile2')
cd Xexpdir cd Xexpdir
@@ -1629,7 +1608,6 @@ func Test_cmdline_expand_home()
call assert_equal('"e ~/Xfile1 ~/Xfile2', @:) call assert_equal('"e ~/Xfile1 ~/Xfile2', @:)
let $HOME = save_HOME let $HOME = save_HOME
cd .. cd ..
call delete('Xexpdir', 'rf')
endfunc endfunc
" Test for using CTRL-\ CTRL-G in the command line to go back to normal mode " Test for using CTRL-\ CTRL-G in the command line to go back to normal mode
@@ -1714,8 +1692,8 @@ func Wildmode_tests()
" Test for longest file name completion with 'fileignorecase' " Test for longest file name completion with 'fileignorecase'
" On MS-Windows, file names are case insensitive. " On MS-Windows, file names are case insensitive.
if has('unix') if has('unix')
call writefile([], 'XTESTfoo') call writefile([], 'XTESTfoo', 'D')
call writefile([], 'Xtestbar') call writefile([], 'Xtestbar', 'D')
set nofileignorecase set nofileignorecase
call feedkeys(":e XT\<Tab>\<C-B>\"\<CR>", 'xt') call feedkeys(":e XT\<Tab>\<C-B>\"\<CR>", 'xt')
call assert_equal('"e XTESTfoo', @:) call assert_equal('"e XTESTfoo', @:)
@@ -1727,8 +1705,6 @@ func Wildmode_tests()
call feedkeys(":e Xt\<Tab>\<C-B>\"\<CR>", 'xt') call feedkeys(":e Xt\<Tab>\<C-B>\"\<CR>", 'xt')
call assert_equal('"e Xtest', @:) call assert_equal('"e Xtest', @:)
set fileignorecase& set fileignorecase&
call delete('XTESTfoo')
call delete('Xtestbar')
endif endif
%argdelete %argdelete
@@ -1750,7 +1726,7 @@ func Test_wildmode()
endfunc endfunc
func Test_custom_complete_autoload() func Test_custom_complete_autoload()
call mkdir('Xcustdir/autoload', 'p') call mkdir('Xcustdir/autoload', 'pR')
let save_rtp = &rtp let save_rtp = &rtp
exe 'set rtp=' .. getcwd() .. '/Xcustdir' exe 'set rtp=' .. getcwd() .. '/Xcustdir'
let lines =<< trim END let lines =<< trim END
@@ -1769,7 +1745,6 @@ func Test_custom_complete_autoload()
let &rtp = save_rtp let &rtp = save_rtp
set wildmode& wildmenu& set wildmode& wildmenu&
delcommand MyCmd delcommand MyCmd
call delete('Xcustdir', 'rf')
endfunc endfunc
" Test for interrupting the command-line completion " Test for interrupting the command-line completion
@@ -1946,7 +1921,7 @@ endfunc
func Test_wildmenu_dirstack() func Test_wildmenu_dirstack()
CheckUnix CheckUnix
%bw! %bw!
call mkdir('Xwildmenu/dir2/dir3/dir4', 'p') call mkdir('Xwildmenu/dir2/dir3/dir4', 'pR')
call writefile([], 'Xwildmenu/file1_1.txt') call writefile([], 'Xwildmenu/file1_1.txt')
call writefile([], 'Xwildmenu/file1_2.txt') call writefile([], 'Xwildmenu/file1_2.txt')
call writefile([], 'Xwildmenu/dir2/file2_1.txt') call writefile([], 'Xwildmenu/dir2/file2_1.txt')
@@ -1974,7 +1949,6 @@ func Test_wildmenu_dirstack()
call feedkeys(":e Xwildmenu/\<Tab>\<Down>\<Down>\<Down>\<C-B>\"\<CR>", 'xt') call feedkeys(":e Xwildmenu/\<Tab>\<Down>\<Down>\<Down>\<C-B>\"\<CR>", 'xt')
call assert_equal('"e Xwildmenu/dir2/dir3/dir4/file4_1.txt', @:) call assert_equal('"e Xwildmenu/dir2/dir3/dir4/file4_1.txt', @:)
call delete('Xwildmenu', 'rf')
set wildmenu& set wildmenu&
endfunc endfunc
@@ -2054,9 +2028,9 @@ endfunc
" Test for the 'suffixes' option " Test for the 'suffixes' option
func Test_suffixes_opt() func Test_suffixes_opt()
call writefile([], 'Xsuffile') call writefile([], 'Xsuffile', 'D')
call writefile([], 'Xsuffile.c') call writefile([], 'Xsuffile.c', 'D')
call writefile([], 'Xsuffile.o') call writefile([], 'Xsuffile.o', 'D')
set suffixes= set suffixes=
call feedkeys(":e Xsuffi*\<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":e Xsuffi*\<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal('"e Xsuffile Xsuffile.c Xsuffile.o', @:) call assert_equal('"e Xsuffile Xsuffile.c Xsuffile.o', @:)
@@ -2076,9 +2050,6 @@ func Test_suffixes_opt()
" Test for getcompletion() with different patterns " Test for getcompletion() with different patterns
call assert_equal(['Xsuffile', 'Xsuffile.c', 'Xsuffile.o'], getcompletion('Xsuffile', 'file')) call assert_equal(['Xsuffile', 'Xsuffile.c', 'Xsuffile.o'], getcompletion('Xsuffile', 'file'))
call assert_equal(['Xsuffile'], getcompletion('Xsuffile$', 'file')) call assert_equal(['Xsuffile'], getcompletion('Xsuffile$', 'file'))
call delete('Xsuffile')
call delete('Xsuffile.c')
call delete('Xsuffile.o')
endfunc endfunc
" Test for using a popup menu for the command line completion matches " Test for using a popup menu for the command line completion matches
@@ -2120,7 +2091,7 @@ func Test_wildmenu_pum()
call feedkeys(":edit $VIMRUNTIME/\<Tab>\<Left>\<C-U>ab\<Tab>") call feedkeys(":edit $VIMRUNTIME/\<Tab>\<Left>\<C-U>ab\<Tab>")
endfunc endfunc
[CODE] [CODE]
call writefile(commands, 'Xtest') call writefile(commands, 'Xtest', 'D')
let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) let buf = RunVimInTerminal('-S Xtest', #{rows: 10})
@@ -2258,7 +2229,7 @@ func Test_wildmenu_pum()
call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {}) call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {})
" Tests a directory name contained full-width characters. " Tests a directory name contained full-width characters.
call mkdir('Xnamedir/あいう', 'p') call mkdir('Xnamedir/あいう', 'pR')
call writefile([], 'Xnamedir/あいう/abc') call writefile([], 'Xnamedir/あいう/abc')
call writefile([], 'Xnamedir/あいう/xyz') call writefile([], 'Xnamedir/あいう/xyz')
call writefile([], 'Xnamedir/あいう/123') call writefile([], 'Xnamedir/あいう/123')
@@ -2346,8 +2317,6 @@ func Test_wildmenu_pum()
call term_sendkeys(buf, "\<C-U>\<CR>") call term_sendkeys(buf, "\<C-U>\<CR>")
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xtest')
call delete('Xnamedir', 'rf')
endfunc endfunc
" Test for wildmenumode() with the cmdline popup menu " Test for wildmenumode() with the cmdline popup menu
@@ -2378,7 +2347,7 @@ func Test_wildmenu_with_pum_foldexpr()
set foldtext=MyFoldText() wildoptions=pum set foldtext=MyFoldText() wildoptions=pum
normal ggzfj normal ggzfj
END END
call writefile(lines, 'Xpumfold') call writefile(lines, 'Xpumfold', 'D')
let buf = RunVimInTerminal('-S Xpumfold', #{rows: 10}) let buf = RunVimInTerminal('-S Xpumfold', #{rows: 10})
call term_sendkeys(buf, ":set\<Tab>") call term_sendkeys(buf, ":set\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_1', {}) call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_1', {})
@@ -2387,7 +2356,6 @@ func Test_wildmenu_with_pum_foldexpr()
call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_2', {}) call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_2', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xpumfold')
endfunc endfunc
" Test for opening the cmdline completion popup menu from the terminal window. " Test for opening the cmdline completion popup menu from the terminal window.
@@ -2402,7 +2370,7 @@ func Test_wildmenu_pum_from_terminal()
let cmds = ['set wildmenu wildoptions=pum'] let cmds = ['set wildmenu wildoptions=pum']
let pcmd = python .. ' -c "import sys; sys.stdout.write(sys.stdin.read())"' let pcmd = python .. ' -c "import sys; sys.stdout.write(sys.stdin.read())"'
call add(cmds, "call term_start('" .. pcmd .. "')") call add(cmds, "call term_start('" .. pcmd .. "')")
call writefile(cmds, 'Xtest') call writefile(cmds, 'Xtest', 'D')
let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) let buf = RunVimInTerminal('-S Xtest', #{rows: 10})
call term_sendkeys(buf, "\r\r\r") call term_sendkeys(buf, "\r\r\r")
call term_wait(buf) call term_wait(buf)
@@ -2411,7 +2379,6 @@ func Test_wildmenu_pum_from_terminal()
call VerifyScreenDump(buf, 'Test_wildmenu_pum_term_01', {}) call VerifyScreenDump(buf, 'Test_wildmenu_pum_term_01', {})
call term_wait(buf) call term_wait(buf)
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xtest')
endfunc endfunc
" Test for completion after a :substitute command followed by a pipe (|) " Test for completion after a :substitute command followed by a pipe (|)
@@ -2511,7 +2478,7 @@ endfunc
func Test_fuzzy_completion_bufname_fullpath() func Test_fuzzy_completion_bufname_fullpath()
CheckUnix CheckUnix
set wildoptions& set wildoptions&
call mkdir('Xcmd/Xstate/Xfile.js', 'p') call mkdir('Xcmd/Xstate/Xfile.js', 'pR')
edit Xcmd/Xstate/Xfile.js edit Xcmd/Xstate/Xfile.js
cd Xcmd/Xstate cd Xcmd/Xstate
enew enew
@@ -2521,7 +2488,6 @@ func Test_fuzzy_completion_bufname_fullpath()
call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx') call feedkeys(":b CmdStateFile\<Tab>\<C-B>\"\<CR>", 'tx')
call assert_match('Xcmd/Xstate/Xfile.js$', @:) call assert_match('Xcmd/Xstate/Xfile.js$', @:)
cd - cd -
call delete('Xcmd', 'rf')
set wildoptions& set wildoptions&
endfunc endfunc
@@ -3028,7 +2994,7 @@ func Test_cmdline_complete_breakadd()
call assert_equal([], l) call assert_equal([], l)
" Test for :breakadd file [lnum] <file> " Test for :breakadd file [lnum] <file>
call writefile([], 'Xscript') call writefile([], 'Xscript', 'D')
call feedkeys(":breakadd file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') call feedkeys(":breakadd file Xsc\<Tab>\<C-B>\"\<CR>", 'tx')
call assert_equal("\"breakadd file Xscript", @:) call assert_equal("\"breakadd file Xscript", @:)
call feedkeys(":breakadd file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') call feedkeys(":breakadd file Xsc\<Tab>\<C-B>\"\<CR>", 'tx')
@@ -3047,7 +3013,6 @@ func Test_cmdline_complete_breakadd()
call assert_equal("\"breakadd file Xscript ", @:) call assert_equal("\"breakadd file Xscript ", @:)
call feedkeys(":breakadd file X1B2C3\<Tab>\<C-B>\"\<CR>", 'tx') call feedkeys(":breakadd file X1B2C3\<Tab>\<C-B>\"\<CR>", 'tx')
call assert_equal("\"breakadd file X1B2C3", @:) call assert_equal("\"breakadd file X1B2C3", @:)
call delete('Xscript')
" Test for :breakadd func [lnum] <function> " Test for :breakadd func [lnum] <function>
func Xbreak_func() func Xbreak_func()
@@ -3109,7 +3074,7 @@ func Test_cmdline_complete_breakdel()
call assert_equal("\"breakdel abc", @:) call assert_equal("\"breakdel abc", @:)
" Test for :breakdel file [lnum] <file> " Test for :breakdel file [lnum] <file>
call writefile([], 'Xscript') call writefile([], 'Xscript', 'D')
call feedkeys(":breakdel file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') call feedkeys(":breakdel file Xsc\<Tab>\<C-B>\"\<CR>", 'tx')
call assert_equal("\"breakdel file Xscript", @:) call assert_equal("\"breakdel file Xscript", @:)
call feedkeys(":breakdel file Xsc\<Tab>\<C-B>\"\<CR>", 'tx') call feedkeys(":breakdel file Xsc\<Tab>\<C-B>\"\<CR>", 'tx')
@@ -3128,7 +3093,6 @@ func Test_cmdline_complete_breakdel()
call assert_equal("\"breakdel file Xscript ", @:) call assert_equal("\"breakdel file Xscript ", @:)
call feedkeys(":breakdel file X1B2C3\<Tab>\<C-B>\"\<CR>", 'tx') call feedkeys(":breakdel file X1B2C3\<Tab>\<C-B>\"\<CR>", 'tx')
call assert_equal("\"breakdel file X1B2C3", @:) call assert_equal("\"breakdel file X1B2C3", @:)
call delete('Xscript')
" Test for :breakdel func [lnum] <function> " Test for :breakdel func [lnum] <function>
func Xbreak_func() func Xbreak_func()
@@ -3165,7 +3129,7 @@ endfunc
" Test for :scriptnames argument completion " Test for :scriptnames argument completion
func Test_cmdline_complete_scriptnames() func Test_cmdline_complete_scriptnames()
set wildmenu set wildmenu
call writefile(['let a = 1'], 'Xa1b2c3.vim') call writefile(['let a = 1'], 'Xa1b2c3.vim', 'D')
source Xa1b2c3.vim source Xa1b2c3.vim
call feedkeys(":script \<Tab>\<Left>\<Left>\<C-B>\"\<CR>", 'tx') call feedkeys(":script \<Tab>\<Left>\<Left>\<C-B>\"\<CR>", 'tx')
call assert_match("\"script .*Xa1b2c3.vim$", @:) call assert_match("\"script .*Xa1b2c3.vim$", @:)
@@ -3185,7 +3149,6 @@ func Test_cmdline_complete_scriptnames()
call feedkeys(":script \<Tab>\<Left>\<Left>\<CR>", 'tx') call feedkeys(":script \<Tab>\<Left>\<Left>\<CR>", 'tx')
call assert_equal('Xa1b2c3.vim', fnamemodify(@%, ':t')) call assert_equal('Xa1b2c3.vim', fnamemodify(@%, ':t'))
bw! bw!
call delete('Xa1b2c3.vim')
set wildmenu& set wildmenu&
endfunc endfunc
@@ -3259,13 +3222,12 @@ func Test_cmdline_redraw_tabline()
set showtabline=2 set showtabline=2
autocmd CmdlineEnter * set tabline=foo autocmd CmdlineEnter * set tabline=foo
END END
call writefile(lines, 'Xcmdline_redraw_tabline') call writefile(lines, 'Xcmdline_redraw_tabline', 'D')
let buf = RunVimInTerminal('-S Xcmdline_redraw_tabline', #{rows: 6}) let buf = RunVimInTerminal('-S Xcmdline_redraw_tabline', #{rows: 6})
call term_sendkeys(buf, ':') call term_sendkeys(buf, ':')
call WaitForAssert({-> assert_match('^foo', term_getline(buf, 1))}) call WaitForAssert({-> assert_match('^foo', term_getline(buf, 1))})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xcmdline_redraw_tabline')
endfunc endfunc
func Test_wildmenu_pum_disable_while_shown() func Test_wildmenu_pum_disable_while_shown()

View File

@@ -70,7 +70,7 @@ func Test_cmdwin_restore()
call setline(1, range(30)) call setline(1, range(30))
2split 2split
[SCRIPT] [SCRIPT]
call writefile(lines, 'XTest_restore') call writefile(lines, 'XTest_restore', 'D')
let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12}) let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12})
call TermWait(buf, 50) call TermWait(buf, 50)
@@ -90,7 +90,6 @@ func Test_cmdwin_restore()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_restore')
endfunc endfunc
func Test_cmdwin_no_terminal() func Test_cmdwin_no_terminal()
@@ -186,7 +185,7 @@ func Test_cmdwin_interrupted()
let lines =<< trim [SCRIPT] let lines =<< trim [SCRIPT]
au WinNew * smile au WinNew * smile
[SCRIPT] [SCRIPT]
call writefile(lines, 'XTest_cmdwin') call writefile(lines, 'XTest_cmdwin', 'D')
let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18}) let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18})
" open cmdwin " open cmdwin
@@ -201,7 +200,6 @@ func Test_cmdwin_interrupted()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_cmdwin')
endfunc endfunc
" Test for recursively getting multiple command line inputs " Test for recursively getting multiple command line inputs

View File

@@ -25,7 +25,7 @@ func Test_conceal_two_windows()
exe "normal /here\r" exe "normal /here\r"
[CODE] [CODE]
call writefile(code, 'XTest_conceal') call writefile(code, 'XTest_conceal', 'D')
" Check that cursor line is concealed " Check that cursor line is concealed
let buf = RunVimInTerminal('-S XTest_conceal', {}) let buf = RunVimInTerminal('-S XTest_conceal', {})
call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {}) call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {})
@@ -109,7 +109,6 @@ func Test_conceal_two_windows()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_conceal')
endfunc endfunc
func Test_conceal_with_cursorline() func Test_conceal_with_cursorline()
@@ -126,7 +125,7 @@ func Test_conceal_with_cursorline()
normal M normal M
[CODE] [CODE]
call writefile(code, 'XTest_conceal_cul') call writefile(code, 'XTest_conceal_cul', 'D')
let buf = RunVimInTerminal('-S XTest_conceal_cul', {}) let buf = RunVimInTerminal('-S XTest_conceal_cul', {})
call VerifyScreenDump(buf, 'Test_conceal_cul_01', {}) call VerifyScreenDump(buf, 'Test_conceal_cul_01', {})
@@ -138,7 +137,6 @@ func Test_conceal_with_cursorline()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_conceal_cul')
endfunc endfunc
func Test_conceal_resize_term() func Test_conceal_resize_term()
@@ -150,7 +148,7 @@ func Test_conceal_resize_term()
syn region CommentCodeSpan matchgroup=Comment start=/`/ end=/`/ concealends syn region CommentCodeSpan matchgroup=Comment start=/`/ end=/`/ concealends
normal fb normal fb
[CODE] [CODE]
call writefile(code, 'XTest_conceal_resize') call writefile(code, 'XTest_conceal_resize', 'D')
let buf = RunVimInTerminal('-S XTest_conceal_resize', {'rows': 6}) let buf = RunVimInTerminal('-S XTest_conceal_resize', {'rows': 6})
call VerifyScreenDump(buf, 'Test_conceal_resize_01', {}) call VerifyScreenDump(buf, 'Test_conceal_resize_01', {})
@@ -159,7 +157,6 @@ func Test_conceal_resize_term()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_conceal_resize')
endfunc endfunc
" Tests for correct display (cursor column position) with +conceal and " Tests for correct display (cursor column position) with +conceal and
@@ -247,7 +244,7 @@ func Test_conceal_cursor_pos()
:q! :q!
[CODE] [CODE]
call writefile(code, 'XTest_conceal_curpos') call writefile(code, 'XTest_conceal_curpos', 'D')
if RunVim([], [], '-s XTest_conceal_curpos') if RunVim([], [], '-s XTest_conceal_curpos')
call assert_equal([ call assert_equal([
@@ -258,7 +255,6 @@ func Test_conceal_cursor_pos()
endif endif
call delete('Xconceal_curpos.out') call delete('Xconceal_curpos.out')
call delete('XTest_conceal_curpos')
endfunc endfunc
func Test_conceal_eol() func Test_conceal_eol()

View File

@@ -8,7 +8,7 @@ source view_util.vim
" file name. " file name.
func Test_cpo_a() func Test_cpo_a()
let save_cpo = &cpo let save_cpo = &cpo
call writefile(['one'], 'XfileCpoA') call writefile(['one'], 'XfileCpoA', 'D')
" Wipe out all the buffers, so that the alternate file is empty " Wipe out all the buffers, so that the alternate file is empty
edit Xfoo | %bw edit Xfoo | %bw
set cpo-=a set cpo-=a
@@ -20,7 +20,6 @@ func Test_cpo_a()
read XfileCpoA read XfileCpoA
call assert_equal('XfileCpoA', @#) call assert_equal('XfileCpoA', @#)
close! close!
call delete('XfileCpoA')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@@ -99,21 +98,20 @@ endfunc
" Test for the 'C' flag in 'cpo' (line continuation) " Test for the 'C' flag in 'cpo' (line continuation)
func Test_cpo_C() func Test_cpo_C()
let save_cpo = &cpo let save_cpo = &cpo
call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC') call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC', 'D')
set cpo-=C set cpo-=C
source XfileCpoC source XfileCpoC
call assert_equal([1, 2], g:l) call assert_equal([1, 2], g:l)
set cpo+=C set cpo+=C
call assert_fails('source XfileCpoC', ['E697:', 'E10:']) call assert_fails('source XfileCpoC', ['E697:', 'E10:'])
call delete('XfileCpoC')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
" Test for the 'd' flag in 'cpo' (tags relative to the current file) " Test for the 'd' flag in 'cpo' (tags relative to the current file)
func Test_cpo_d() func Test_cpo_d()
let save_cpo = &cpo let save_cpo = &cpo
call mkdir('XdirCpoD') call mkdir('XdirCpoD', 'R')
call writefile(["one\tXfile1\t/^one$/"], 'tags') call writefile(["one\tXfile1\t/^one$/"], 'tags', 'D')
call writefile(["two\tXfile2\t/^two$/"], 'XdirCpoD/tags') call writefile(["two\tXfile2\t/^two$/"], 'XdirCpoD/tags')
set tags=./tags set tags=./tags
set cpo-=d set cpo-=d
@@ -121,9 +119,8 @@ func Test_cpo_d()
call assert_equal('two', taglist('.*')[0].name) call assert_equal('two', taglist('.*')[0].name)
set cpo+=d set cpo+=d
call assert_equal('one', taglist('.*')[0].name) call assert_equal('one', taglist('.*')[0].name)
%bw! %bw!
call delete('tags')
call delete('XdirCpoD', 'rf')
set tags& set tags&
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@@ -415,14 +412,13 @@ func Test_cpo_O()
let save_cpo = &cpo let save_cpo = &cpo
new XfileCpoO new XfileCpoO
call setline(1, 'one') call setline(1, 'one')
call writefile(['two'], 'XfileCpoO') call writefile(['two'], 'XfileCpoO', 'D')
set cpo-=O set cpo-=O
call assert_fails('write', 'E13:') call assert_fails('write', 'E13:')
set cpo+=O set cpo+=O
write write
call assert_equal(['one'], readfile('XfileCpoO')) call assert_equal(['one'], readfile('XfileCpoO'))
close! close!
call delete('XfileCpoO')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@@ -432,7 +428,7 @@ endfunc
" name) " name)
func Test_cpo_P() func Test_cpo_P()
let save_cpo = &cpo let save_cpo = &cpo
call writefile([], 'XfileCpoP') call writefile([], 'XfileCpoP', 'D')
new new
call setline(1, 'one') call setline(1, 'one')
set cpo+=F set cpo+=F
@@ -443,7 +439,6 @@ func Test_cpo_P()
write >> XfileCpoP write >> XfileCpoP
call assert_equal('XfileCpoP', @%) call assert_equal('XfileCpoP', @%)
close! close!
call delete('XfileCpoP')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@@ -635,7 +630,7 @@ endfunc
" Test for the 'Z' flag in 'cpo' (write! resets 'readonly') " Test for the 'Z' flag in 'cpo' (write! resets 'readonly')
func Test_cpo_Z() func Test_cpo_Z()
let save_cpo = &cpo let save_cpo = &cpo
call writefile([], 'XfileCpoZ') call writefile([], 'XfileCpoZ', 'D')
new XfileCpoZ new XfileCpoZ
setlocal readonly setlocal readonly
set cpo-=Z set cpo-=Z
@@ -646,7 +641,6 @@ func Test_cpo_Z()
write! write!
call assert_equal(1, &readonly) call assert_equal(1, &readonly)
close! close!
call delete('XfileCpoZ')
let &cpo = save_cpo let &cpo = save_cpo
endfunc endfunc
@@ -723,7 +717,7 @@ endfunc
" flag) " flag)
func Test_cpo_plus() func Test_cpo_plus()
let save_cpo = &cpo let save_cpo = &cpo
call writefile([], 'XfileCpoPlus') call writefile([], 'XfileCpoPlus', 'D')
new XfileCpoPlus new XfileCpoPlus
call setline(1, 'foo') call setline(1, 'foo')
write X1 write X1
@@ -732,7 +726,6 @@ func Test_cpo_plus()
write X2 write X2
call assert_equal(0, &modified) call assert_equal(0, &modified)
close! close!
call delete('XfileCpoPlus')
call delete('X1') call delete('X1')
call delete('X2') call delete('X2')
let &cpo = save_cpo let &cpo = save_cpo
@@ -835,7 +828,7 @@ endfunc
" Test for the '&' flag in 'cpo'. The swap file is kept when a buffer is still " Test for the '&' flag in 'cpo'. The swap file is kept when a buffer is still
" loaded and ':preserve' is used. " loaded and ':preserve' is used.
func Test_cpo_ampersand() func Test_cpo_ampersand()
call writefile(['one'], 'XfileCpoAmp') call writefile(['one'], 'XfileCpoAmp', 'D')
let after =<< trim [CODE] let after =<< trim [CODE]
set cpo+=& set cpo+=&
preserve preserve
@@ -845,7 +838,6 @@ func Test_cpo_ampersand()
call assert_equal(1, filereadable('.XfileCpoAmp.swp')) call assert_equal(1, filereadable('.XfileCpoAmp.swp'))
call delete('.XfileCpoAmp.swp') call delete('.XfileCpoAmp.swp')
endif endif
call delete('XfileCpoAmp')
endfunc endfunc
" Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern) " Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern)

View File

@@ -300,7 +300,7 @@ endfunc
" Test ":cs add {dir}" (add the {dir}/cscope.out database) " Test ":cs add {dir}" (add the {dir}/cscope.out database)
func Test_cscope_add_dir() func Test_cscope_add_dir()
call mkdir('Xcscopedir', 'p') call mkdir('Xcscopedir', 'pD')
" Cscope doesn't handle symlinks, so this needs to be resolved in case a " Cscope doesn't handle symlinks, so this needs to be resolved in case a
" shadow directory is being used. " shadow directory is being used.
@@ -318,8 +318,6 @@ func Test_cscope_add_dir()
cs kill -1 cs kill -1
call delete('Xcscopedir/cscope.out') call delete('Xcscopedir/cscope.out')
call assert_fails('cs add Xcscopedir', 'E563:') call assert_fails('cs add Xcscopedir', 'E563:')
call delete('Xcscopedir', 'd')
endfunc endfunc
func Test_cscopequickfix() func Test_cscopequickfix()

View File

@@ -133,7 +133,7 @@ func Test_cursorline_screenline()
call extend(lines, lines1) call extend(lines, lines1)
call extend(lines, ["call append(0, ".. string(file_content).. ')']) call extend(lines, ["call append(0, ".. string(file_content).. ')'])
call extend(lines, lines2) call extend(lines, lines2)
call writefile(lines, filename) call writefile(lines, filename, 'D')
" basic test " basic test
let buf = RunVimInTerminal('-S '. filename, #{rows: 20}) let buf = RunVimInTerminal('-S '. filename, #{rows: 20})
call VerifyScreenDump(buf, 'Test_'. filename. '_1', {}) call VerifyScreenDump(buf, 'Test_'. filename. '_1', {})
@@ -196,7 +196,6 @@ func Test_cursorline_screenline()
call term_sendkeys(buf, ":set list& cursorlineopt& listchars&\<cr>") call term_sendkeys(buf, ":set list& cursorlineopt& listchars&\<cr>")
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete(filename)
endfunc endfunc
func Test_cursorline_redraw() func Test_cursorline_redraw()
@@ -227,13 +226,13 @@ set all" or ":verbose set" without an argument.
When the option was set by hand there is no "Last set" message. When the option was set by hand there is no "Last set" message.
When the option was set while executing a function, user command or When the option was set while executing a function, user command or
END END
call writefile(textlines, 'Xtextfile') call writefile(textlines, 'Xtextfile', 'D')
let script =<< trim END let script =<< trim END
set cursorline scrolloff=2 set cursorline scrolloff=2
normal 12G normal 12G
END END
call writefile(script, 'Xscript') call writefile(script, 'Xscript', 'D')
let buf = RunVimInTerminal('-S Xscript Xtextfile', #{rows: 20, cols: 40}) let buf = RunVimInTerminal('-S Xscript Xtextfile', #{rows: 20, cols: 40})
call VerifyScreenDump(buf, 'Test_cursorline_redraw_1', {}) call VerifyScreenDump(buf, 'Test_cursorline_redraw_1', {})
@@ -243,8 +242,6 @@ END
call VerifyScreenDump(buf, 'Test_cursorline_redraw_2', {}) call VerifyScreenDump(buf, 'Test_cursorline_redraw_2', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xscript')
call delete('Xtextfile')
endfunc endfunc
func Test_cursorline_callback() func Test_cursorline_callback()
@@ -262,14 +259,13 @@ func Test_cursorline_callback()
call timer_start(300, 'Func') call timer_start(300, 'Func')
END END
call writefile(lines, 'Xcul_timer') call writefile(lines, 'Xcul_timer', 'D')
let buf = RunVimInTerminal('-S Xcul_timer', #{rows: 8}) let buf = RunVimInTerminal('-S Xcul_timer', #{rows: 8})
call TermWait(buf, 310) call TermWait(buf, 310)
call VerifyScreenDump(buf, 'Test_cursorline_callback_1', {}) call VerifyScreenDump(buf, 'Test_cursorline_callback_1', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xcul_timer')
endfunc endfunc
func Test_cursorline_screenline_update() func Test_cursorline_screenline_update()
@@ -280,7 +276,7 @@ func Test_cursorline_screenline_update()
set cursorline cursorlineopt=screenline set cursorline cursorlineopt=screenline
inoremap <F2> <Cmd>call cursor(1, 1)<CR> inoremap <F2> <Cmd>call cursor(1, 1)<CR>
END END
call writefile(lines, 'Xcul_screenline') call writefile(lines, 'Xcul_screenline', 'D')
let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8}) let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8})
call term_sendkeys(buf, "A") call term_sendkeys(buf, "A")
@@ -290,7 +286,6 @@ func Test_cursorline_screenline_update()
call term_sendkeys(buf, "\<Esc>") call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xcul_screenline')
endfunc endfunc
func Test_cursorline_cursorbind_horizontal_scroll() func Test_cursorline_cursorbind_horizontal_scroll()
@@ -307,7 +302,7 @@ func Test_cursorline_cursorbind_horizontal_scroll()
20vsp 20vsp
windo :set cursorbind windo :set cursorbind
END END
call writefile(lines, 'Xhor_scroll') call writefile(lines, 'Xhor_scroll', 'D')
let buf = RunVimInTerminal('-S Xhor_scroll', #{rows: 8}) let buf = RunVimInTerminal('-S Xhor_scroll', #{rows: 8})
call term_sendkeys(buf, "20l") call term_sendkeys(buf, "20l")
@@ -326,7 +321,6 @@ func Test_cursorline_cursorbind_horizontal_scroll()
call VerifyScreenDump(buf, 'Test_hor_scroll_5', {}) call VerifyScreenDump(buf, 'Test_hor_scroll_5', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xhor_scroll')
endfunc endfunc

View File

@@ -703,6 +703,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
418,
/**/ /**/
417, 417,
/**/ /**/