1
0
forked from aniani/vim

patch 9.0.0669: too many delete() calls in tests

Problem:    Too many delete() calls in tests.
Solution:   Use deferred delete where possible.
This commit is contained in:
Bram Moolenaar
2022-10-05 21:45:30 +01:00
parent 3ff71cda98
commit db77cb3c08
6 changed files with 80 additions and 165 deletions

View File

@@ -396,7 +396,7 @@ func XfileTests(cchar)
Xtestfile1:700:10:Line 700 Xtestfile1:700:10:Line 700
Xtestfile2:800:15:Line 800 Xtestfile2:800:15:Line 800
END END
call writefile(lines, 'Xqftestfile1') call writefile(lines, 'Xqftestfile1', 'D')
enew! enew!
Xfile Xqftestfile1 Xfile Xqftestfile1
@@ -439,8 +439,6 @@ func XfileTests(cchar)
call writefile([t], 'Xqftestfile1', 'b') call writefile([t], 'Xqftestfile1', 'b')
silent! Xfile Xqftestfile1 silent! Xfile Xqftestfile1
call assert_equal(text, g:Xgetlist()[0].text) call assert_equal(text, g:Xgetlist()[0].text)
call delete('Xqftestfile1')
endfunc endfunc
func Test_cfile() func Test_cfile()
@@ -795,10 +793,9 @@ func Xnomem_tests(cchar)
call assert_fails('Xbuffer', 'E342:') call assert_fails('Xbuffer', 'E342:')
%bw! %bw!
call writefile([repeat('a', 8192)], 'Xtest') call writefile([repeat('a', 8192)], 'Xtest', 'D')
call test_alloc_fail(GetAllocId('qf_linebuf'), 0, 0) call test_alloc_fail(GetAllocId('qf_linebuf'), 0, 0)
call assert_fails('Xfile Xtest', 'E342:') call assert_fails('Xfile Xtest', 'E342:')
call delete('Xtest')
endfunc endfunc
func Test_nomem() func Test_nomem()
@@ -899,7 +896,7 @@ def Test_helpgrep_vim9_restore_cpo()
var rtp_save = &rtp var rtp_save = &rtp
var dir = 'Xruntime/after' var dir = 'Xruntime/after'
&rtp ..= ',' .. dir &rtp ..= ',' .. dir
mkdir(dir .. '/ftplugin', 'p') mkdir(dir .. '/ftplugin', 'pR')
writefile(['vim9script'], dir .. '/ftplugin/qf.vim') writefile(['vim9script'], dir .. '/ftplugin/qf.vim')
filetype plugin on filetype plugin on
silent helpgrep grail silent helpgrep grail
@@ -907,7 +904,6 @@ def Test_helpgrep_vim9_restore_cpo()
silent helpgrep grail silent helpgrep grail
assert_equal('aABceFs', &cpo) assert_equal('aABceFs', &cpo)
delete('Xruntime', 'rf')
&rtp = rtp_save &rtp = rtp_save
cclose cclose
helpclose helpclose
@@ -1180,8 +1176,8 @@ func Test_locationlist_curwin_was_closed()
endfunc endfunc
func Test_locationlist_cross_tab_jump() func Test_locationlist_cross_tab_jump()
call writefile(['loclistfoo'], 'loclistfoo') call writefile(['loclistfoo'], 'loclistfoo', 'D')
call writefile(['loclistbar'], 'loclistbar') call writefile(['loclistbar'], 'loclistbar', 'D')
set switchbuf=usetab set switchbuf=usetab
edit loclistfoo edit loclistfoo
@@ -1191,8 +1187,6 @@ func Test_locationlist_cross_tab_jump()
enew | only | tabonly enew | only | tabonly
set switchbuf&vim set switchbuf&vim
call delete('loclistfoo')
call delete('loclistbar')
endfunc endfunc
" More tests for 'errorformat' " More tests for 'errorformat'
@@ -1237,8 +1231,9 @@ func Test_efm1()
"Xtestfile", line 22 col 9: What is the title of the quickfix window? "Xtestfile", line 22 col 9: What is the title of the quickfix window?
[DATA] [DATA]
call writefile(l, 'Xerrorfile1') call writefile(l, 'Xerrorfile1', 'D')
call writefile(l[:-2], 'Xerrorfile2') call delete('loclistbar')
call writefile(l[:-2], 'Xerrorfile2', 'D')
let m =<< [DATA] let m =<< [DATA]
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2
@@ -1263,7 +1258,7 @@ func Test_efm1()
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22
[DATA] [DATA]
call writefile(m, 'Xtestfile') call writefile(m, 'Xtestfile', 'D')
let save_efm = &efm let save_efm = &efm
set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m
@@ -1309,9 +1304,6 @@ func Test_efm1()
wincmd p wincmd p
let &efm = save_efm let &efm = save_efm
call delete('Xerrorfile1')
call delete('Xerrorfile2')
call delete('Xtestfile')
endfunc endfunc
" Test for quickfix directory stack support " Test for quickfix directory stack support
@@ -1363,11 +1355,11 @@ endfunc
" Tests for %D and %X errorformat options " Tests for %D and %X errorformat options
func Test_efm_dirstack() func Test_efm_dirstack()
" Create the directory stack and files " Create the directory stack and files
call mkdir('dir1') call mkdir('dir1', 'R')
call mkdir('dir1/a') call mkdir('dir1/a')
call mkdir('dir1/a/b') call mkdir('dir1/a/b')
call mkdir('dir1/c') call mkdir('dir1/c')
call mkdir('dir2') call mkdir('dir2', 'R')
let lines =<< trim END let lines =<< trim END
Nine Healthy Habits Nine Healthy Habits
@@ -1382,7 +1374,7 @@ func Test_efm_dirstack()
8 Hours of sleep (at least) 8 Hours of sleep (at least)
9 PM end of the day and off to bed 9 PM end of the day and off to bed
END END
call writefile(lines, 'habits1.txt') call writefile(lines, 'habits1.txt', 'D')
call writefile(lines, 'dir1/a/habits2.txt') call writefile(lines, 'dir1/a/habits2.txt')
call writefile(lines, 'dir1/a/b/habits3.txt') call writefile(lines, 'dir1/a/b/habits3.txt')
call writefile(lines, 'dir1/c/habits4.txt') call writefile(lines, 'dir1/c/habits4.txt')
@@ -1390,10 +1382,6 @@ func Test_efm_dirstack()
call s:dir_stack_tests('c') call s:dir_stack_tests('c')
call s:dir_stack_tests('l') call s:dir_stack_tests('l')
call delete('dir1', 'rf')
call delete('dir2', 'rf')
call delete('habits1.txt')
endfunc endfunc
" Test for resync after continuing an ignored message " Test for resync after continuing an ignored message
@@ -1518,9 +1506,9 @@ func Test_efm2()
set efm=%+P[%f]%r,(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%+Q--%r set efm=%+P[%f]%r,(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%+Q--%r
" To exercise the push/pop file functionality in quickfix, the test files " To exercise the push/pop file functionality in quickfix, the test files
" need to be created. " need to be created.
call writefile(['Line1'], 'Xtestfile1') call writefile(['Line1'], 'Xtestfile1', 'D')
call writefile(['Line2'], 'Xtestfile2') call writefile(['Line2'], 'Xtestfile2', 'D')
call writefile(['Line3'], 'Xtestfile3') call writefile(['Line3'], 'Xtestfile3', 'D')
cexpr "" cexpr ""
for l in lines for l in lines
caddexpr l caddexpr l
@@ -1531,9 +1519,6 @@ func Test_efm2()
call assert_equal(2, l[2].col) call assert_equal(2, l[2].col)
call assert_equal('w', l[2].type) call assert_equal('w', l[2].type)
call assert_equal('e', l[3].type) call assert_equal('e', l[3].type)
call delete('Xtestfile1')
call delete('Xtestfile2')
call delete('Xtestfile3')
" Test for %P, %Q with non-existing files " Test for %P, %Q with non-existing files
cexpr lines cexpr lines
@@ -1602,7 +1587,7 @@ func Test_efm2()
" Test for %o " Test for %o
set efm=%f(%o):%l\ %m set efm=%f(%o):%l\ %m
cgetexpr ['Xotestfile(Language.PureScript.Types):20 Error'] cgetexpr ['Xotestfile(Language.PureScript.Types):20 Error']
call writefile(['Line1'], 'Xotestfile') call writefile(['Line1'], 'Xotestfile', 'D')
let l = getqflist() let l = getqflist()
call assert_equal(1, len(l), string(l)) call assert_equal(1, len(l), string(l))
call assert_equal('Language.PureScript.Types', l[0].module) call assert_equal('Language.PureScript.Types', l[0].module)
@@ -1612,7 +1597,6 @@ func Test_efm2()
call assert_equal('Xotestfile', expand('%:t')) call assert_equal('Xotestfile', expand('%:t'))
cclose cclose
bd bd
call delete("Xotestfile")
" Test for a long module name " Test for a long module name
cexpr 'Xtest(' . repeat('m', 1026) . '):15 message' cexpr 'Xtest(' . repeat('m', 1026) . '):15 message'
@@ -1776,7 +1760,7 @@ func Test_quickfix_was_changed_by_autocmd()
endfunc endfunc
func Test_setloclist_in_autocommand() func Test_setloclist_in_autocommand()
call writefile(['test1', 'test2'], 'Xfile') call writefile(['test1', 'test2'], 'Xfile', 'D')
edit Xfile edit Xfile
let s:bufnr = bufnr() let s:bufnr = bufnr()
call setloclist(1, call setloclist(1,
@@ -1796,7 +1780,6 @@ func Test_setloclist_in_autocommand()
augroup Test_LocList augroup Test_LocList
au! au!
augroup END augroup END
call delete('Xfile')
endfunc endfunc
func Test_caddbuffer_to_empty() func Test_caddbuffer_to_empty()
@@ -2129,11 +2112,10 @@ func Test_cgetfile_on_long_lines()
/tmp/file4:1:1:ccc /tmp/file4:1:1:ccc
END END
let lines[1] = substitute(lines[1], '%s', repeat('x', len), '') let lines[1] = substitute(lines[1], '%s', repeat('x', len), '')
call writefile(lines, 'Xcqetfile.txt') call writefile(lines, 'Xcqetfile.txt', 'D')
cgetfile Xcqetfile.txt cgetfile Xcqetfile.txt
call assert_equal(4, getqflist(#{size: v:true}).size, 'with length ' .. len) call assert_equal(4, getqflist(#{size: v:true}).size, 'with length ' .. len)
endfor endfor
call delete('Xcqetfile.txt')
endfunc endfunc
func s:create_test_file(filename) func s:create_test_file(filename)
@@ -2274,7 +2256,7 @@ func Test_switchbuf()
" If opening a file changes 'switchbuf', then the new value should be " If opening a file changes 'switchbuf', then the new value should be
" retained. " retained.
set modeline&vim set modeline&vim
call writefile(["vim: switchbuf=split"], 'Xqftestfile1') call writefile(["vim: switchbuf=split"], 'Xqftestfile1', 'D')
enew | only enew | only
set switchbuf&vim set switchbuf&vim
cexpr "Xqftestfile1:1:10" cexpr "Xqftestfile1:1:10"
@@ -2290,7 +2272,6 @@ func Test_switchbuf()
cexpr "Xqftestfile1:1:10" cexpr "Xqftestfile1:1:10"
call assert_equal('', &switchbuf) call assert_equal('', &switchbuf)
call delete('Xqftestfile1')
call delete('Xqftestfile2') call delete('Xqftestfile2')
call delete('Xqftestfile3') call delete('Xqftestfile3')
set switchbuf&vim set switchbuf&vim
@@ -2385,8 +2366,8 @@ func Test_two_windows()
" Use one 'errorformat' for two windows. Add an expression to each of them, " Use one 'errorformat' for two windows. Add an expression to each of them,
" make sure they each keep their own state. " make sure they each keep their own state.
set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f' set efm=%DEntering\ dir\ '%f',%f:%l:%m,%XLeaving\ dir\ '%f'
call mkdir('Xone/a', 'p') call mkdir('Xone/a', 'pR')
call mkdir('Xtwo/a', 'p') call mkdir('Xtwo/a', 'pR')
let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7'] let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7']
call writefile(lines, 'Xone/a/one.txt') call writefile(lines, 'Xone/a/one.txt')
call writefile(lines, 'Xtwo/a/two.txt') call writefile(lines, 'Xtwo/a/two.txt')
@@ -2418,8 +2399,6 @@ func Test_two_windows()
bwipe! bwipe!
call win_gotoid(two_id) call win_gotoid(two_id)
bwipe! bwipe!
call delete('Xone', 'rf')
call delete('Xtwo', 'rf')
endfunc endfunc
func XbottomTests(cchar) func XbottomTests(cchar)
@@ -2503,12 +2482,10 @@ func Test_duplicate_buf()
let last_buffer = bufnr("$") let last_buffer = bufnr("$")
" make sure only one buffer is created " make sure only one buffer is created
call writefile(['this one', 'that one'], 'Xgrepthis') call writefile(['this one', 'that one'], 'Xgrepthis', 'D')
vimgrep one Xgrepthis vimgrep one Xgrepthis
vimgrep one Xgrepthis vimgrep one Xgrepthis
call assert_equal(last_buffer + 1, bufnr("$")) call assert_equal(last_buffer + 1, bufnr("$"))
call delete('Xgrepthis')
endfunc endfunc
" Quickfix/Location list set/get properties tests " Quickfix/Location list set/get properties tests
@@ -2876,8 +2853,8 @@ func Test_Autocmd()
END END
call assert_equal(l, g:acmds) call assert_equal(l, g:acmds)
call writefile(['Xtest:1:Line1'], 'Xtest') call writefile(['Xtest:1:Line1'], 'Xtest', 'D')
call writefile([], 'Xempty') call writefile([], 'Xempty', 'D')
let g:acmds = [] let g:acmds = []
cfile Xtest cfile Xtest
caddfile Xtest caddfile Xtest
@@ -2976,8 +2953,6 @@ func Test_Autocmd()
call assert_equal(l, g:acmds) call assert_equal(l, g:acmds)
endif endif
call delete('Xtest')
call delete('Xempty')
au! QuickFixCmdPre au! QuickFixCmdPre
au! QuickFixCmdPost au! QuickFixCmdPost
endfunc endfunc
@@ -3137,7 +3112,7 @@ func Test_cwindow_highlight()
redraw redraw
cwindow 4 cwindow 4
END END
call writefile(lines, 'XtestCwindow') call writefile(lines, 'XtestCwindow', 'D')
let buf = RunVimInTerminal('-S XtestCwindow', #{rows: 12}) let buf = RunVimInTerminal('-S XtestCwindow', #{rows: 12})
call VerifyScreenDump(buf, 'Test_quickfix_cwindow_1', {}) call VerifyScreenDump(buf, 'Test_quickfix_cwindow_1', {})
@@ -3152,7 +3127,6 @@ func Test_cwindow_highlight()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestCwindow')
call delete('XCwindow') call delete('XCwindow')
endfunc endfunc
@@ -3164,8 +3138,8 @@ func XvimgrepTests(cchar)
Editor:Emacs EmAcS Editor:Emacs EmAcS
Editor:Notepad NOTEPAD Editor:Notepad NOTEPAD
END END
call writefile(lines, 'Xtestfile1') call writefile(lines, 'Xtestfile1', 'D')
call writefile(['Linux', 'macOS', 'MS-Windows'], 'Xtestfile2') call writefile(['Linux', 'macOS', 'MS-Windows'], 'Xtestfile2', 'D')
" Error cases " Error cases
call assert_fails('Xvimgrep /abc *', 'E682:') call assert_fails('Xvimgrep /abc *', 'E682:')
@@ -3221,9 +3195,6 @@ func XvimgrepTests(cchar)
augroup QF_Test augroup QF_Test
au! au!
augroup END augroup END
call delete('Xtestfile1')
call delete('Xtestfile2')
endfunc endfunc
" Tests for the :vimgrep command " Tests for the :vimgrep command
@@ -3261,11 +3232,10 @@ func Test_vimgrep_with_no_last_search_pat()
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
@@ -3276,17 +3246,16 @@ func Test_vimgrep_without_swap_file()
call writefile(['done'], 'Xresult') call writefile(['done'], 'Xresult')
qall! qall!
[SCRIPT] [SCRIPT]
call writefile(lines, 'Xscript') call writefile(lines, 'Xscript', 'D')
if RunVim([], [], '--clean -n -S Xscript Xscript') if RunVim([], [], '--clean -n -S Xscript Xscript')
call assert_equal(['done'], readfile('Xresult')) call assert_equal(['done'], readfile('Xresult'))
endif endif
call delete('Xscript')
call delete('Xresult') call delete('Xresult')
endfunc endfunc
func Test_vimgrep_existing_swapfile() func Test_vimgrep_existing_swapfile()
call writefile(['match apple with apple'], 'Xapple') call writefile(['match apple with apple'], 'Xapple', 'D')
call writefile(['swapfile'], '.Xapple.swp') call writefile(['swapfile'], '.Xapple.swp', 'D')
let g:foundSwap = 0 let g:foundSwap = 0
let g:ignoreSwapExists = 1 let g:ignoreSwapExists = 1
augroup grep augroup grep
@@ -3296,8 +3265,6 @@ func Test_vimgrep_existing_swapfile()
call assert_equal(1, g:foundSwap) call assert_equal(1, g:foundSwap)
call assert_match('.Xapple.swo', swapname('')) call assert_match('.Xapple.swo', swapname(''))
call delete('Xapple')
call delete('.Xapple.swp')
augroup grep augroup grep
au! SwapExists au! SwapExists
augroup END augroup END
@@ -3638,8 +3605,8 @@ func Xmultidirstack_tests(cchar)
endfunc endfunc
func Test_multidirstack() func Test_multidirstack()
call mkdir('Xone/a', 'p') call mkdir('Xone/a', 'pR')
call mkdir('Xtwo/a', 'p') call mkdir('Xtwo/a', 'pR')
let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7'] let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7']
call writefile(lines, 'Xone/a/one.txt') call writefile(lines, 'Xone/a/one.txt')
call writefile(lines, 'Xtwo/a/two.txt') call writefile(lines, 'Xtwo/a/two.txt')
@@ -3650,8 +3617,6 @@ func Test_multidirstack()
call Xmultidirstack_tests('l') call Xmultidirstack_tests('l')
let &efm = save_efm let &efm = save_efm
call delete('Xone', 'rf')
call delete('Xtwo', 'rf')
endfunc endfunc
" Tests for per quickfix/location list file stack " Tests for per quickfix/location list file stack
@@ -3700,8 +3665,8 @@ endfunc
func Test_multifilestack() func Test_multifilestack()
let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7'] let lines = ['1', '2', 'one one one', '4', 'two two two', '6', '7']
call writefile(lines, 'one.txt') call writefile(lines, 'one.txt', 'D')
call writefile(lines, 'two.txt') call writefile(lines, 'two.txt', 'D')
let save_efm = &efm let save_efm = &efm
set efm=%+P[%f],(%l\\,%c)\ %m,%-Q set efm=%+P[%f],(%l\\,%c)\ %m,%-Q
@@ -3709,14 +3674,12 @@ func Test_multifilestack()
call Xmultifilestack_tests('l') call Xmultifilestack_tests('l')
let &efm = save_efm let &efm = save_efm
call delete('one.txt')
call delete('two.txt')
endfunc endfunc
" Tests for per buffer 'efm' setting " Tests for per buffer 'efm' setting
func Test_perbuf_efm() func Test_perbuf_efm()
call writefile(["File1-10-Line10"], 'one.txt') call writefile(["File1-10-Line10"], 'one.txt', 'D')
call writefile(["File2#20#Line20"], 'two.txt') call writefile(["File2#20#Line20"], 'two.txt', 'D')
set efm=%f#%l#%m set efm=%f#%l#%m
new | only new | only
new new
@@ -3731,8 +3694,6 @@ func Test_perbuf_efm()
set efm& set efm&
new | only new | only
call delete('one.txt')
call delete('two.txt')
endfunc endfunc
" Open multiple help windows using ":lhelpgrep " Open multiple help windows using ":lhelpgrep
@@ -3908,9 +3869,9 @@ endfunc
func Xqfjump_tests(cchar) func Xqfjump_tests(cchar)
call s:setup_commands(a:cchar) call s:setup_commands(a:cchar)
call writefile(["Line1\tFoo", "Line2"], 'F1') call writefile(["Line1\tFoo", "Line2"], 'F1', 'D')
call writefile(["Line1\tBar", "Line2"], 'F2') call writefile(["Line1\tBar", "Line2"], 'F2', 'D')
call writefile(["Line1\tBaz", "Line2"], 'F3') call writefile(["Line1\tBaz", "Line2"], 'F3', 'D')
call g:Xsetlist([], 'f') call g:Xsetlist([], 'f')
@@ -3999,10 +3960,6 @@ func Xqfjump_tests(cchar)
" Cleanup " Cleanup
enew! enew!
new | only new | only
call delete('F1')
call delete('F2')
call delete('F3')
endfunc endfunc
func Test_qfjump() func Test_qfjump()
@@ -4118,9 +4075,8 @@ func Test_empty_list_quickfixtextfunc()
let &quickfixtextfunc = 's:Func' let &quickfixtextfunc = 's:Func'
cgetfile [ex cgetfile [ex
END END
call writefile(lines, 'Xquickfixtextfunc') call writefile(lines, 'Xquickfixtextfunc', 'D')
call RunVim([], [], '-e -s -S Xquickfixtextfunc -c qa') call RunVim([], [], '-e -s -S Xquickfixtextfunc -c qa')
call delete('Xquickfixtextfunc')
endfunc endfunc
func Test_getqflist() func Test_getqflist()
@@ -4173,7 +4129,7 @@ func Xqftick_tests(cchar)
\ {'filename' : 'F7', 'lnum' : 11, 'text' : 'L11'}], 'r') \ {'filename' : 'F7', 'lnum' : 11, 'text' : 'L11'}], 'r')
call assert_equal(2, g:Xgetlist({'changedtick' : 0}).changedtick) call assert_equal(2, g:Xgetlist({'changedtick' : 0}).changedtick)
call writefile(["F8:80:L80", "F8:81:L81"], "Xone") call writefile(["F8:80:L80", "F8:81:L81"], "Xone", 'D')
Xfile Xone Xfile Xone
call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick)
Xaddfile Xone Xaddfile Xone
@@ -4186,8 +4142,6 @@ func Xqftick_tests(cchar)
call g:Xsetlist([], 'a', {'nr' : 1, "lines" : ["F10:10:L10"]}) call g:Xsetlist([], 'a', {'nr' : 1, "lines" : ["F10:10:L10"]})
call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick) call assert_equal(1, g:Xgetlist({'changedtick' : 0}).changedtick)
call assert_equal(2, g:Xgetlist({'nr' : 1, 'changedtick' : 0}).changedtick) call assert_equal(2, g:Xgetlist({'nr' : 1, 'changedtick' : 0}).changedtick)
call delete("Xone")
endfunc endfunc
func Test_qf_tick() func Test_qf_tick()
@@ -4341,8 +4295,8 @@ endfunc
" :vimgrep/:lvimgrep commands are running. " :vimgrep/:lvimgrep commands are running.
func Test_vimgrep_autocmd() func Test_vimgrep_autocmd()
call setqflist([], 'f') call setqflist([], 'f')
call writefile(['stars'], 'Xtest1.txt') call writefile(['stars'], 'Xtest1.txt', 'D')
call writefile(['stars'], 'Xtest2.txt') call writefile(['stars'], 'Xtest2.txt', 'D')
" Test 1: " Test 1:
" When searching for a pattern using :vimgrep, if the quickfix list is " When searching for a pattern using :vimgrep, if the quickfix list is
@@ -4373,8 +4327,6 @@ func Test_vimgrep_autocmd()
call assert_fails('lvimgrep stars Xtest*.txt', 'E926:') call assert_fails('lvimgrep stars Xtest*.txt', 'E926:')
au! BufRead Xtest2.txt au! BufRead Xtest2.txt
call delete('Xtest1.txt')
call delete('Xtest2.txt')
call setqflist([], 'f') call setqflist([], 'f')
endfunc endfunc
@@ -4403,14 +4355,13 @@ func Xvimgrep_autocmd_cd(cchar)
endfunc endfunc
func Test_vimgrep_autocmd_cd() func Test_vimgrep_autocmd_cd()
call mkdir('Xgrepdir/a', 'p') call mkdir('Xgrepdir/a', 'pR')
call mkdir('Xgrepdir/b', 'p') call mkdir('Xgrepdir/b', 'pR')
call writefile(['a_L1_vim', 'a_L2_vim'], 'Xgrepdir/a/f1.txt') call writefile(['a_L1_vim', 'a_L2_vim'], 'Xgrepdir/a/f1.txt')
call writefile(['b_L1_vim', 'b_L2_vim'], 'Xgrepdir/b/f2.txt') call writefile(['b_L1_vim', 'b_L2_vim'], 'Xgrepdir/b/f2.txt')
call Xvimgrep_autocmd_cd('c') call Xvimgrep_autocmd_cd('c')
call Xvimgrep_autocmd_cd('l') call Xvimgrep_autocmd_cd('l')
%bwipe %bwipe
call delete('Xgrepdir', 'rf')
endfunc endfunc
" The following test used to crash Vim " The following test used to crash Vim
@@ -4539,7 +4490,7 @@ endfunc
" Otherwise due to indentation, the title is set with spaces at the beginning " Otherwise due to indentation, the title is set with spaces at the beginning
" of the command. " of the command.
func Test_qftitle() func Test_qftitle()
call writefile(["F1:1:Line1"], 'Xerr') call writefile(["F1:1:Line1"], 'Xerr', 'D')
" :cexpr " :cexpr
exe "cexpr readfile('Xerr')" exe "cexpr readfile('Xerr')"
@@ -4617,7 +4568,6 @@ func Test_qftitle()
call assert_equal(':setqflist()', getqflist({'title' : 1}).title) call assert_equal(':setqflist()', getqflist({'title' : 1}).title)
close close
call delete('Xerr')
call setqflist([], ' ', {'title' : 'Errors'}) call setqflist([], ' ', {'title' : 'Errors'})
copen copen
@@ -4700,7 +4650,7 @@ func Xjumpto_first_error_test(cchar)
" Test for cfile/lfile " Test for cfile/lfile
enew enew
call writefile(l, 'Xerr') call writefile(l, 'Xerr', 'D')
Xfile Xerr Xfile Xerr
call assert_equal('Xtestfile1', @%) call assert_equal('Xtestfile1', @%)
call assert_equal(2, line('.')) call assert_equal(2, line('.'))
@@ -4711,7 +4661,6 @@ func Xjumpto_first_error_test(cchar)
call assert_equal('Xtestfile1', @%) call assert_equal('Xtestfile1', @%)
call assert_equal(2, line('.')) call assert_equal(2, line('.'))
call delete('Xerr')
call delete('Xtestfile1') call delete('Xtestfile1')
call delete('Xtestfile2') call delete('Xtestfile2')
endfunc endfunc
@@ -4731,7 +4680,7 @@ func Xautocmd_changelist(cchar)
call s:create_test_file('Xtestfile2') call s:create_test_file('Xtestfile2')
Xexpr 'Xtestfile1:2:Line2' Xexpr 'Xtestfile1:2:Line2'
autocmd QuickFixCmdPost * Xolder autocmd QuickFixCmdPost * Xolder
call writefile(['Xtestfile2:4:Line4'], 'Xerr') call writefile(['Xtestfile2:4:Line4'], 'Xerr', 'D')
Xfile Xerr Xfile Xerr
call assert_equal('Xtestfile2', @%) call assert_equal('Xtestfile2', @%)
call assert_equal(4, line('.')) call assert_equal(4, line('.'))
@@ -4802,7 +4751,6 @@ func Xautocmd_changelist(cchar)
call assert_fails('silent Xvimgrep Line5 Xtestfile2', 'E480:') call assert_fails('silent Xvimgrep Line5 Xtestfile2', 'E480:')
autocmd! QuickFixCmdPost autocmd! QuickFixCmdPost
call delete('Xerr')
call delete('Xtestfile1') call delete('Xtestfile1')
call delete('Xtestfile2') call delete('Xtestfile2')
endfunc endfunc
@@ -4919,7 +4867,7 @@ endfunc
" Test for parsing entries using visual screen column " Test for parsing entries using visual screen column
func Test_viscol() func Test_viscol()
enew enew
call writefile(["Col1\tCol2\tCol3"], 'Xfile1') call writefile(["Col1\tCol2\tCol3"], 'Xfile1', 'D')
edit Xfile1 edit Xfile1
" Use byte offset for column number " Use byte offset for column number
@@ -4984,7 +4932,6 @@ func Test_viscol()
enew | only enew | only
set efm& set efm&
call delete('Xfile1')
endfunc endfunc
" Test for the quickfix window buffer " Test for the quickfix window buffer
@@ -5101,14 +5048,13 @@ endfunc
" a normal buffer. " a normal buffer.
func Test_empty_qfbuf() func Test_empty_qfbuf()
enew | only enew | only
call writefile(["Test"], 'Xfile1') call writefile(["Test"], 'Xfile1', 'D')
call setqflist([], 'f') call setqflist([], 'f')
copen | only copen | only
let qfbuf = bufnr('') let qfbuf = bufnr('')
edit Xfile1 edit Xfile1
call assert_notequal(qfbuf, bufnr('')) call assert_notequal(qfbuf, bufnr(''))
enew enew
call delete('Xfile1')
endfunc endfunc
" Test for the :cbelow, :cabove, :lbelow and :labove commands. " Test for the :cbelow, :cabove, :lbelow and :labove commands.
@@ -5341,7 +5287,7 @@ func Xtest_qfcmd_abort(cchar)
call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr) call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
" cfile/lfile " cfile/lfile
call writefile(["F1:10:Line10", "F2:20:Line20"], 'Xfile1') call writefile(["F1:10:Line10", "F2:20:Line20"], 'Xfile1', 'D')
let e = '' let e = ''
try try
Xfile Xfile1 Xfile Xfile1
@@ -5350,7 +5296,6 @@ func Xtest_qfcmd_abort(cchar)
endtry endtry
call assert_equal('AbortCmd', e) call assert_equal('AbortCmd', e)
call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr) call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
call delete('Xfile1')
" cgetbuffer/lgetbuffer " cgetbuffer/lgetbuffer
enew! enew!
@@ -5414,7 +5359,7 @@ endfunc
" Test for using a file in one of the parent directories. " Test for using a file in one of the parent directories.
func Test_search_in_dirstack() func Test_search_in_dirstack()
call mkdir('Xtestdir/a/b/c', 'p') call mkdir('Xtestdir/a/b/c', 'pR')
let save_cwd = getcwd() let save_cwd = getcwd()
call writefile(["X1_L1", "X1_L2"], 'Xtestdir/Xfile1') call writefile(["X1_L1", "X1_L2"], 'Xtestdir/Xfile1')
call writefile(["X2_L1", "X2_L2"], 'Xtestdir/a/Xfile2') call writefile(["X2_L1", "X2_L2"], 'Xtestdir/a/Xfile2')
@@ -5451,7 +5396,6 @@ func Test_search_in_dirstack()
set efm& set efm&
exe 'cd ' . save_cwd exe 'cd ' . save_cwd
call delete('Xtestdir', 'rf')
endfunc endfunc
" Test for :cquit " Test for :cquit
@@ -5895,7 +5839,7 @@ endfunc
" Running :lhelpgrep command more than once in a help window, doesn't jump to " Running :lhelpgrep command more than once in a help window, doesn't jump to
" the help topic " the help topic
func Test_lhelpgrep_from_help_window() func Test_lhelpgrep_from_help_window()
call mkdir('Xtestdir/doc', 'p') call mkdir('Xtestdir/doc', 'pR')
call writefile(['window'], 'Xtestdir/doc/a.txt') call writefile(['window'], 'Xtestdir/doc/a.txt')
call writefile(['buffer'], 'Xtestdir/doc/b.txt') call writefile(['buffer'], 'Xtestdir/doc/b.txt')
let save_rtp = &rtp let save_rtp = &rtp
@@ -5906,7 +5850,6 @@ func Test_lhelpgrep_from_help_window()
lhelpgrep window lhelpgrep window
call assert_equal('a.txt', fnamemodify(@%, ":p:t")) call assert_equal('a.txt', fnamemodify(@%, ":p:t"))
let &rtp = save_rtp let &rtp = save_rtp
call delete('Xtestdir', 'rf')
new | only! new | only!
endfunc endfunc
@@ -5993,7 +5936,7 @@ func Test_quickfix_window_fails_to_open()
anything anything
endtry endtry
END END
call writefile(lines, 'XquickfixFails') call writefile(lines, 'XquickfixFails', 'D')
let lines =<< trim END let lines =<< trim END
split XquickfixFails split XquickfixFails
@@ -6004,7 +5947,7 @@ func Test_quickfix_window_fails_to_open()
" is aborted but the window was already split. " is aborted but the window was already split.
silent! cwindow silent! cwindow
END END
call writefile(lines, 'XtestWinFails') call writefile(lines, 'XtestWinFails', 'D')
let buf = RunVimInTerminal('-S XtestWinFails', #{rows: 13}) let buf = RunVimInTerminal('-S XtestWinFails', #{rows: 13})
call VerifyScreenDump(buf, 'Test_quickfix_window_fails', {}) call VerifyScreenDump(buf, 'Test_quickfix_window_fails', {})
@@ -6012,8 +5955,6 @@ func Test_quickfix_window_fails_to_open()
call term_sendkeys(buf, ":bwipe!\<CR>") call term_sendkeys(buf, ":bwipe!\<CR>")
call term_wait(buf) call term_wait(buf)
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestWinFails')
call delete('XquickfixFails')
endfunc endfunc
" Test for updating the quickfix buffer whenever the associated quickfix list " Test for updating the quickfix buffer whenever the associated quickfix list
@@ -6076,11 +6017,10 @@ endfunc
func Test_vimgrep_noswapfile() func Test_vimgrep_noswapfile()
set noswapfile set noswapfile
call writefile(['one', 'two', 'three'], 'Xgreppie') call writefile(['one', 'two', 'three'], 'Xgreppie', 'D')
vimgrep two Xgreppie vimgrep two Xgreppie
call assert_equal('two', getline('.')) call assert_equal('two', getline('.'))
call delete('Xgreppie')
set swapfile set swapfile
endfunc endfunc
@@ -6122,12 +6062,10 @@ func Xvimgrep_fuzzy_match(cchar)
endfunc endfunc
func Test_vimgrep_fuzzy_match() func Test_vimgrep_fuzzy_match()
call writefile(['one two three', 'aaaaaa'], 'Xfile1') call writefile(['one two three', 'aaaaaa'], 'Xfile1', 'D')
call writefile(['one', 'three one two', 'two', 'aaathreeaaa'], 'Xfile2') call writefile(['one', 'three one two', 'two', 'aaathreeaaa'], 'Xfile2', 'D')
call Xvimgrep_fuzzy_match('c') call Xvimgrep_fuzzy_match('c')
call Xvimgrep_fuzzy_match('l') call Xvimgrep_fuzzy_match('l')
call delete('Xfile1')
call delete('Xfile2')
endfunc endfunc
func Test_locationlist_open_in_newtab() func Test_locationlist_open_in_newtab()
@@ -6265,12 +6203,11 @@ func Test_lopen_bwipe_all()
call writefile(['done'], 'Xresult') call writefile(['done'], 'Xresult')
qall! qall!
END END
call writefile(lines, 'Xscript') call writefile(lines, 'Xscript', 'D')
if RunVim([], [], '-u NONE -n -X -Z -e -m -s -S Xscript') if RunVim([], [], '-u NONE -n -X -Z -e -m -s -S Xscript')
call assert_equal(['done'], readfile('Xresult')) call assert_equal(['done'], readfile('Xresult'))
endif endif
call delete('Xscript')
call delete('Xresult') call delete('Xresult')
endfunc endfunc

View File

@@ -140,9 +140,9 @@ func Test_recover_multiple_swap_files()
call setline(1, ['a', 'b', 'c']) call setline(1, ['a', 'b', 'c'])
preserve preserve
let b = readblob(swapname('')) let b = readblob(swapname(''))
call writefile(b, '.Xfile1.swm') call writefile(b, '.Xfile1.swm', 'D')
call writefile(b, '.Xfile1.swn') call writefile(b, '.Xfile1.swn', 'D')
call writefile(b, '.Xfile1.swo') call writefile(b, '.Xfile1.swo', 'D')
%bw! %bw!
call feedkeys(":recover Xfile1\<CR>3\<CR>q", 'xt') call feedkeys(":recover Xfile1\<CR>3\<CR>q", 'xt')
call assert_equal(['a', 'b', 'c'], getline(1, '$')) call assert_equal(['a', 'b', 'c'], getline(1, '$'))
@@ -156,16 +156,12 @@ func Test_recover_multiple_swap_files()
call assert_equal('Xfile1', @%) call assert_equal('Xfile1', @%)
call assert_equal([''], getline(1, '$')) call assert_equal([''], getline(1, '$'))
bw! bw!
call delete('.Xfile1.swm')
call delete('.Xfile1.swn')
call delete('.Xfile1.swo')
endfunc endfunc
" Test for :recover using an empty swap file " Test for :recover using an empty swap file
func Test_recover_empty_swap_file() func Test_recover_empty_swap_file()
CheckUnix CheckUnix
call writefile([], '.Xfile1.swp') call writefile([], '.Xfile1.swp', 'D')
let msg = execute('recover Xfile1') let msg = execute('recover Xfile1')
call assert_match('Unable to read block 0 from .Xfile1.swp', msg) call assert_match('Unable to read block 0 from .Xfile1.swp', msg)
call assert_equal('Xfile1', @%) call assert_equal('Xfile1', @%)
@@ -178,7 +174,6 @@ func Test_recover_empty_swap_file()
" :recover from an empty buffer " :recover from an empty buffer
call assert_fails('recover', 'E305:') call assert_fails('recover', 'E305:')
call delete('.Xfile1.swp')
endfunc endfunc
" Test for :recover using a corrupted swap file " Test for :recover using a corrupted swap file
@@ -366,11 +361,10 @@ func Test_recover_unreadable_swap_file()
CheckNotRoot CheckNotRoot
new Xfile1 new Xfile1
let b = readblob('.Xfile1.swp') let b = readblob('.Xfile1.swp')
call writefile(b, '.Xfile1.swm') call writefile(b, '.Xfile1.swm', 'D')
bw! bw!
call setfperm('.Xfile1.swm', '-w-------') call setfperm('.Xfile1.swm', '-w-------')
call assert_fails('recover Xfile1', 'E306:') call assert_fails('recover Xfile1', 'E306:')
call delete('.Xfile1.swm')
endfunc endfunc
" Test for using :recover when the original file and the swap file have the " Test for using :recover when the original file and the swap file have the
@@ -382,20 +376,19 @@ func Test_recover_unmodified_file()
preserve preserve
let b = readblob('.Xfile1.swp') let b = readblob('.Xfile1.swp')
%bw! %bw!
call writefile(b, '.Xfile1.swz') call writefile(b, '.Xfile1.swz', 'D')
let msg = execute('recover Xfile1') let msg = execute('recover Xfile1')
call assert_equal(['aaa', 'bbb', 'ccc'], getline(1, '$')) call assert_equal(['aaa', 'bbb', 'ccc'], getline(1, '$'))
call assert_false(&modified) call assert_false(&modified)
call assert_match('Buffer contents equals file contents', msg) call assert_match('Buffer contents equals file contents', msg)
bw! bw!
call delete('Xfile1') call delete('Xfile1')
call delete('.Xfile1.swz')
endfunc endfunc
" Test for recovering a file when editing a symbolically linked file " Test for recovering a file when editing a symbolically linked file
func Test_recover_symbolic_link() func Test_recover_symbolic_link()
CheckUnix CheckUnix
call writefile(['aaa', 'bbb', 'ccc'], 'Xfile1') call writefile(['aaa', 'bbb', 'ccc'], 'Xfile1', 'D')
silent !ln -s Xfile1 Xfile2 silent !ln -s Xfile1 Xfile2
edit Xfile2 edit Xfile2
call assert_equal('.Xfile1.swp', fnamemodify(swapname(''), ':t')) call assert_equal('.Xfile1.swp', fnamemodify(swapname(''), ':t'))
@@ -410,7 +403,6 @@ func Test_recover_symbolic_link()
update update
%bw! %bw!
call assert_equal(['aaa', 'bbb', 'ccc'], readfile('Xfile1')) call assert_equal(['aaa', 'bbb', 'ccc'], readfile('Xfile1'))
call delete('Xfile1')
call delete('Xfile2') call delete('Xfile2')
call delete('.Xfile1.swp') call delete('.Xfile1.swp')
endfunc endfunc
@@ -419,7 +411,7 @@ endfunc
" line. This used to result in an internal error (E315) which is fixed " line. This used to result in an internal error (E315) which is fixed
" by 8.2.2966. " by 8.2.2966.
func Test_recover_invalid_cursor_pos() func Test_recover_invalid_cursor_pos()
call writefile([], 'Xfile1') call writefile([], 'Xfile1', 'D')
edit Xfile1 edit Xfile1
preserve preserve
let b = readblob('.Xfile1.swp') let b = readblob('.Xfile1.swp')
@@ -429,7 +421,7 @@ func Test_recover_invalid_cursor_pos()
au BufReadPost Xfile1 normal! 3G au BufReadPost Xfile1 normal! 3G
augroup END augroup END
call writefile(range(1, 3), 'Xfile1') call writefile(range(1, 3), 'Xfile1')
call writefile(b, '.Xfile1.swp') call writefile(b, '.Xfile1.swp', 'D')
try try
recover Xfile1 recover Xfile1
catch /E308:/ catch /E308:/
@@ -441,8 +433,6 @@ func Test_recover_invalid_cursor_pos()
au! au!
augroup END augroup END
augroup! Test augroup! Test
call delete('Xfile1')
call delete('.Xfile1.swp')
endfunc endfunc
" Test for recovering a buffer without a name " Test for recovering a buffer without a name
@@ -453,10 +443,9 @@ func Test_noname_buffer()
let sn = swapname('') let sn = swapname('')
let b = readblob(sn) let b = readblob(sn)
bw! bw!
call writefile(b, sn) call writefile(b, sn, 'D')
exe "recover " .. sn exe "recover " .. sn
call assert_equal(['one', 'two'], getline(1, '$')) call assert_equal(['one', 'two'], getline(1, '$'))
call delete(sn)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -555,20 +555,17 @@ func Test_match_char_class_upper()
endfunc endfunc
func Test_match_invalid_byte() func Test_match_invalid_byte()
call writefile(0z630a.765d30aa0a.2e0a.790a.4030, 'Xinvalid') call writefile(0z630a.765d30aa0a.2e0a.790a.4030, 'Xinvalid', 'D')
new new
source Xinvalid source Xinvalid
bwipe! bwipe!
call delete('Xinvalid')
endfunc endfunc
func Test_match_illegal_byte() func Test_match_illegal_byte()
" Text has illegal bytes which need to be set explicitly " Text has illegal bytes which need to be set explicitly
let lines = ["norm :set no\x01\<CR>", "silent n\xff", "silent norm :b\xff\<CR>"] let lines = ["norm :set no\x01\<CR>", "silent n\xff", "silent norm :b\xff\<CR>"]
call writefile(lines, 'Xregexp') call writefile(lines, 'Xregexp', 'D')
call system(GetVimCommand() .. ' -X -Z -e -s -S Xregexp -c qa!') call system(GetVimCommand() .. ' -X -Z -e -s -S Xregexp -c qa!')
call delete('Xregexp')
endfunc endfunc
func Test_match_too_complicated() func Test_match_too_complicated()

View File

@@ -12,7 +12,7 @@ func Test_rename_file_to_file()
" When the destination file already exists, it should be overwritten. " When the destination file already exists, it should be overwritten.
call writefile(['foo'], 'Xrename1') call writefile(['foo'], 'Xrename1')
call writefile(['bar'], 'Xrename2') call writefile(['bar'], 'Xrename2', 'D')
call assert_equal(0, rename('Xrename1', 'Xrename2')) call assert_equal(0, rename('Xrename1', 'Xrename2'))
call assert_equal('', glob('Xrename1')) call assert_equal('', glob('Xrename1'))
@@ -36,7 +36,7 @@ func Test_rename_file_ignore_case()
endfunc endfunc
func Test_rename_same_file() func Test_rename_same_file()
call writefile(['foo'], 'Xrename') call writefile(['foo'], 'Xrename', 'D')
" When the source and destination are the same file, nothing " When the source and destination are the same file, nothing
" should be done. The source file should not be deleted. " should be done. The source file should not be deleted.
@@ -45,8 +45,6 @@ func Test_rename_same_file()
call assert_equal(0, rename('./Xrename', 'Xrename')) call assert_equal(0, rename('./Xrename', 'Xrename'))
call assert_equal(['foo'], readfile('Xrename')) call assert_equal(['foo'], readfile('Xrename'))
call delete('Xrename')
endfunc endfunc
func Test_rename_dir_to_dir() func Test_rename_dir_to_dir()
@@ -63,21 +61,18 @@ func Test_rename_dir_to_dir()
endfunc endfunc
func Test_rename_same_dir() func Test_rename_same_dir()
call mkdir('Xrenamedir') call mkdir('Xrenamedir', 'R')
call writefile(['foo'], 'Xrenamedir/Xrenamefile') call writefile(['foo'], 'Xrenamedir/Xrenamefile')
call assert_equal(0, rename('Xrenamedir', 'Xrenamedir')) call assert_equal(0, rename('Xrenamedir', 'Xrenamedir'))
call assert_equal(['foo'], readfile('Xrenamedir/Xrenamefile')) call assert_equal(['foo'], readfile('Xrenamedir/Xrenamefile'))
call delete('Xrenamedir/Xrenamefile')
call delete('Xrenamedir', 'd')
endfunc endfunc
func Test_rename_copy() func Test_rename_copy()
" Check that when original file can't be deleted, rename() " Check that when original file can't be deleted, rename()
" still succeeds but copies the file. " still succeeds but copies the file.
call mkdir('Xrenamedir') call mkdir('Xrenamedir', 'R')
call writefile(['foo'], 'Xrenamedir/Xrenamefile') call writefile(['foo'], 'Xrenamedir/Xrenamefile')
call setfperm('Xrenamedir', 'r-xr-xr-x') call setfperm('Xrenamedir', 'r-xr-xr-x')
@@ -91,13 +86,11 @@ func Test_rename_copy()
call assert_equal(['foo'], readfile('Xrenamefile')) call assert_equal(['foo'], readfile('Xrenamefile'))
call setfperm('Xrenamedir', 'rwxrwxrwx') call setfperm('Xrenamedir', 'rwxrwxrwx')
call delete('Xrenamedir/Xrenamefile')
call delete('Xrenamedir', 'd')
call delete('Xrenamefile') call delete('Xrenamefile')
endfunc endfunc
func Test_rename_fails() func Test_rename_fails()
call writefile(['foo'], 'Xrenamefile') call writefile(['foo'], 'Xrenamefile', 'D')
" Can't rename into a non-existing directory. " Can't rename into a non-existing directory.
call assert_notequal(0, rename('Xrenamefile', 'Xdoesnotexist/Xrenamefile')) call assert_notequal(0, rename('Xrenamefile', 'Xdoesnotexist/Xrenamefile'))
@@ -115,8 +108,6 @@ func Test_rename_fails()
call assert_fails('call rename("Xrenamefile", [])', 'E730:') call assert_fails('call rename("Xrenamefile", [])', 'E730:')
call assert_fails('call rename(0z, "Xrenamefile")', 'E976:') call assert_fails('call rename(0z, "Xrenamefile")', 'E976:')
call delete('Xrenamefile')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -101,7 +101,7 @@ func Test_restricted_mode()
call writefile(v:errors, 'Xresult') call writefile(v:errors, 'Xresult')
qa! qa!
END END
call writefile(lines, 'Xrestricted') call writefile(lines, 'Xrestricted', 'D')
if RunVim([], [], '-Z --clean -S Xrestricted') if RunVim([], [], '-Z --clean -S Xrestricted')
call assert_equal([], readfile('Xresult')) call assert_equal([], readfile('Xresult'))
endif endif
@@ -114,7 +114,6 @@ func Test_restricted_mode()
call assert_equal([], readfile('Xresult')) call assert_equal([], readfile('Xresult'))
endif endif
call delete('Xrestricted')
call delete('Xresult') call delete('Xresult')
endfunc endfunc

View File

@@ -699,6 +699,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 */
/**/
669,
/**/ /**/
668, 668,
/**/ /**/