summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-29 21:01:57 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-29 21:01:57 +0100
commit7dd5a78b88af7734bdbf236fdfafb49f27a0ca2e (patch)
tree4b4a6aabc97d0e33296c24b8b70b841f7a5c063b
parentac38ec7c7f7cb0ab94397dc19bd72b0a84afdbe5 (diff)
patch 9.0.0625: too many delete() calls in testsv9.0.0625
Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
-rw-r--r--src/testdir/test_iminsert.vim3
-rw-r--r--src/testdir/test_indent.vim3
-rw-r--r--src/testdir/test_ins_complete.vim62
-rw-r--r--src/testdir/test_jumplist.vim4
-rw-r--r--src/testdir/test_lambda.vim3
-rw-r--r--src/testdir/test_let.vim15
-rw-r--r--src/testdir/test_listchars.vim3
-rw-r--r--src/testdir/test_lua.vim7
-rw-r--r--src/testdir/test_popup.vim25
-rw-r--r--src/version.c2
10 files changed, 47 insertions, 80 deletions
diff --git a/src/testdir/test_iminsert.vim b/src/testdir/test_iminsert.vim
index 9f3ede3379..11fe24ee44 100644
--- a/src/testdir/test_iminsert.vim
+++ b/src/testdir/test_iminsert.vim
@@ -79,7 +79,7 @@ func Test_imactivatefunc_imstatusfunc_callback_no_breaks_foldopen()
call setline(1, ['{{{', 'abc', '}}}'])
%foldclose
END
- call writefile(lines, 'Xscript')
+ call writefile(lines, 'Xscript', 'D')
let buf = RunVimInTerminal('-S Xscript', {})
call assert_notequal('abc', term_getline(buf, 2))
call term_sendkeys(buf, "/abc\n")
@@ -87,7 +87,6 @@ func Test_imactivatefunc_imstatusfunc_callback_no_breaks_foldopen()
" clean up
call StopVimInTerminal(buf)
- call delete('Xscript')
endfunc
" Test for using an lmap in insert mode
diff --git a/src/testdir/test_indent.vim b/src/testdir/test_indent.vim
index 97c44b8bb5..290855ed93 100644
--- a/src/testdir/test_indent.vim
+++ b/src/testdir/test_indent.vim
@@ -161,7 +161,7 @@ func Test_modeline_indent_expr()
func GetIndent()
return line('.') * 2
endfunc
- call writefile(['# vim: indentexpr=GetIndent()'], 'Xmlfile.txt')
+ call writefile(['# vim: indentexpr=GetIndent()'], 'Xmlfile.txt', 'D')
set modelineexpr
new Xmlfile.txt
call assert_equal('GetIndent()', &indentexpr)
@@ -172,7 +172,6 @@ func Test_modeline_indent_expr()
delfunc GetIndent
let &modeline = modeline
close!
- call delete('Xmlfile.txt')
endfunc
func Test_indent_func_with_gq()
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index 3fc55ec1cd..582824f1c7 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -15,14 +15,14 @@ func Test_ins_complete()
set ff=unix
call writefile(["test11\t36Gepeto\t/Tag/",
\ "asd\ttest11file\t36G",
- \ "Makefile\tto\trun"], 'Xtestfile')
+ \ "Makefile\tto\trun"], 'Xtestfile', 'D')
call writefile(['', 'start of testfile',
\ 'ru',
\ 'run1',
\ 'run2',
\ 'STARTTEST',
\ 'ENDTEST',
- \ 'end of testfile'], 'Xtestdata')
+ \ 'end of testfile'], 'Xtestdata', 'D')
set ff&
enew!
@@ -99,10 +99,8 @@ func Test_ins_complete()
call assert_equal('asd', getline('.'))
%bw!
- call delete('Xtestfile')
call delete('Xtest11.one')
call delete('Xtest11.two')
- call delete('Xtestdata')
set cpt& cot& def& tags& tagbsearch& hidden&
cd ..
call delete('Xcpldir', 'rf')
@@ -111,13 +109,11 @@ endfunc
func Test_ins_complete_invalid_byte()
if has('unix') && executable('base64')
" this weird command was causing an illegal memory access
- call writefile(['bm9ybTlvMDCAMM4Dbw4OGA4ODg=='], 'Xinvalid64')
+ call writefile(['bm9ybTlvMDCAMM4Dbw4OGA4ODg=='], 'Xinvalid64', 'D')
call system('base64 -d Xinvalid64 > Xinvalid')
- call writefile(['qa!'], 'Xexit')
+ call writefile(['qa!'], 'Xexit', 'D')
call RunVim([], [], " -i NONE -n -X -Z -e -m -s -S Xinvalid -S Xexit")
- call delete('Xinvalid64')
call delete('Xinvalid')
- call delete('Xexit')
endif
endfunc
@@ -168,7 +164,7 @@ func Test_omni_autoload()
let save_rtp = &rtp
set rtp=Xruntime/some
let dir = 'Xruntime/some/autoload'
- call mkdir(dir, 'p')
+ call mkdir(dir, 'pR')
let lines =<< trim END
vim9script
@@ -190,7 +186,6 @@ func Test_omni_autoload()
call feedkeys("i\<C-X>\<C-O>\<Esc>", 'xt')
bwipe!
- call delete('Xruntime', 'rf')
set omnifunc=
let &rtp = save_rtp
endfunc
@@ -433,7 +428,7 @@ endfunc
func Test_ins_completeslash()
CheckMSWindows
- call mkdir('Xcpldir')
+ call mkdir('Xcpldir', 'R')
let orig_shellslash = &shellslash
set cpt&
new
@@ -466,7 +461,6 @@ func Test_ins_completeslash()
exe "normal oXcp\<C-X>\<C-F>"
call assert_equal('Xcpldir/', getline('.'))
%bw!
- call delete('Xcpldir', 'rf')
set noshellslash
set completeslash=slash
@@ -487,7 +481,7 @@ func Test_pum_stopped_by_timer()
endfunc
END
- call writefile(lines, 'Xpumscript')
+ call writefile(lines, 'Xpumscript', 'D')
let buf = RunVimInTerminal('-S Xpumscript', #{rows: 12})
call term_sendkeys(buf, ":call StartCompl()\<CR>")
call TermWait(buf, 200)
@@ -495,7 +489,6 @@ func Test_pum_stopped_by_timer()
call VerifyScreenDump(buf, 'Test_pum_stopped_by_timer', {})
call StopVimInTerminal(buf)
- call delete('Xpumscript')
endfunc
func Test_complete_stopinsert_startinsert()
@@ -520,7 +513,7 @@ func Test_pum_with_folds_two_tabs()
call feedkeys("0fa", 'xt')
END
- call writefile(lines, 'Xpumscript')
+ call writefile(lines, 'Xpumscript', 'D')
let buf = RunVimInTerminal('-S Xpumscript', #{rows: 10})
call TermWait(buf, 50)
call term_sendkeys(buf, "a\<C-N>")
@@ -528,7 +521,6 @@ func Test_pum_with_folds_two_tabs()
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
- call delete('Xpumscript')
endfunc
func Test_pum_with_preview_win()
@@ -545,7 +537,7 @@ func Test_pum_with_preview_win()
set completeopt+=longest
END
- call writefile(lines, 'Xpreviewscript')
+ call writefile(lines, 'Xpreviewscript', 'D')
let buf = RunVimInTerminal('-S Xpreviewscript', #{rows: 12})
call term_sendkeys(buf, "Gi\<C-X>\<C-O>")
call TermWait(buf, 200)
@@ -554,7 +546,6 @@ func Test_pum_with_preview_win()
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
- call delete('Xpreviewscript')
endfunc
func Test_scrollbar_on_wide_char()
@@ -566,13 +557,12 @@ func Test_scrollbar_on_wide_char()
\ ' 呃呃呃'])
call setline(5, range(10)->map({i, v -> 'aa' .. v .. 'bb'}))
END
- call writefile(lines, 'Xwidescript')
+ call writefile(lines, 'Xwidescript', 'D')
let buf = RunVimInTerminal('-S Xwidescript', #{rows: 10})
call term_sendkeys(buf, "A\<C-N>")
call VerifyScreenDump(buf, 'Test_scrollbar_on_wide_char', {})
call StopVimInTerminal(buf)
- call delete('Xwidescript')
endfunc
" Test for inserting the tag search pattern in insert mode
@@ -582,14 +572,14 @@ func Test_ins_compl_tag_sft()
\ "first\tXfoo\t/^int first() {}$/",
\ "second\tXfoo\t/^int second() {}$/",
\ "third\tXfoo\t/^int third() {}$/"],
- \ 'Xtags')
+ \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int second() {}
int third() {}
[CODE]
- call writefile(code, 'Xfoo')
+ call writefile(code, 'Xfoo', 'D')
enew
set showfulltag
@@ -597,8 +587,6 @@ func Test_ins_compl_tag_sft()
call assert_equal('int second() {}', getline(1))
set noshowfulltag
- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe!
endfunc
@@ -978,8 +966,8 @@ endfunc
" Test for completing words from unloaded buffers
func Test_complete_from_unloadedbuf()
- call writefile(['abc'], "Xfile1")
- call writefile(['def'], "Xfile2")
+ call writefile(['abc'], "Xfile1", 'D')
+ call writefile(['def'], "Xfile2", 'D')
edit Xfile1
edit Xfile2
new | close
@@ -991,15 +979,14 @@ func Test_complete_from_unloadedbuf()
call assert_equal('abc', getline(1))
exe "normal! od\<C-P>"
call assert_equal('def', getline(2))
+
set complete&
%bw!
- call delete("Xfile1")
- call delete("Xfile2")
endfunc
" Test for completing whole lines from unloaded buffers
func Test_complete_wholeline_unloadedbuf()
- call writefile(['a line1', 'a line2', 'a line3'], "Xfile1")
+ call writefile(['a line1', 'a line2', 'a line3'], "Xfile1", 'D')
edit Xfile1
enew
set complete=u
@@ -1010,15 +997,15 @@ func Test_complete_wholeline_unloadedbuf()
bdel Xfile1
exe "normal! ia\<C-X>\<C-L>\<C-P>"
call assert_equal('a', getline(1))
+
set complete&
%bw!
- call delete("Xfile1")
endfunc
" Test for completing words from unlisted buffers
func Test_complete_from_unlistedbuf()
- call writefile(['abc'], "Xfile1")
- call writefile(['def'], "Xfile2")
+ call writefile(['abc'], "Xfile1", 'D')
+ call writefile(['def'], "Xfile2", 'D')
edit Xfile1
edit Xfile2
new | close
@@ -1029,15 +1016,14 @@ func Test_complete_from_unlistedbuf()
call assert_equal('abc', getline(1))
exe "normal! od\<C-P>"
call assert_equal('def', getline(2))
+
set complete&
%bw!
- call delete("Xfile1")
- call delete("Xfile2")
endfunc
" Test for completing whole lines from unlisted buffers
func Test_complete_wholeline_unlistedbuf()
- call writefile(['a line1', 'a line2', 'a line3'], "Xfile1")
+ call writefile(['a line1', 'a line2', 'a line3'], "Xfile1", 'D')
edit Xfile1
enew
set complete=U
@@ -1048,9 +1034,9 @@ func Test_complete_wholeline_unlistedbuf()
bdel Xfile1
exe "normal! ia\<C-X>\<C-L>\<C-P>"
call assert_equal('a line2', getline(1))
+
set complete&
%bw!
- call delete("Xfile1")
endfunc
" Test for adding a multibyte character using CTRL-L in completion mode
@@ -1246,14 +1232,14 @@ func Test_complete_unreadable_thesaurus_file()
CheckUnix
CheckNotRoot
- call writefile(['about', 'above'], 'Xunrfile')
+ call writefile(['about', 'above'], 'Xunrfile', 'D')
call setfperm('Xunrfile', '---r--r--')
new
set complete=sXfile
exe "normal! ia\<C-P>"
call assert_equal('a', getline(1))
+
bw!
- call delete('Xunrfile')
set complete&
endfunc
diff --git a/src/testdir/test_jumplist.vim b/src/testdir/test_jumplist.vim
index 054fda083b..4b5e3213fe 100644
--- a/src/testdir/test_jumplist.vim
+++ b/src/testdir/test_jumplist.vim
@@ -15,7 +15,7 @@ func Test_getjumplist()
for i in range(1, 100)
call add(lines, "Line " . i)
endfor
- call writefile(lines, "Xtest")
+ call writefile(lines, "Xtest", 'D')
" Jump around and create a jump list
edit Xtest
@@ -57,8 +57,6 @@ func Test_getjumplist()
clearjumps
call test_garbagecollect_now()
call assert_equal(4, l[1])
-
- call delete("Xtest")
endfunc
func Test_jumplist_invalid()
diff --git a/src/testdir/test_lambda.vim b/src/testdir/test_lambda.vim
index 1a69a9bfa5..3e348a0a01 100644
--- a/src/testdir/test_lambda.vim
+++ b/src/testdir/test_lambda.vim
@@ -354,7 +354,7 @@ func Test_closure_error()
return 1
endfunc
END
- call writefile(l, 'Xscript')
+ call writefile(l, 'Xscript', 'D')
let caught_932 = 0
try
source Xscript
@@ -362,7 +362,6 @@ func Test_closure_error()
let caught_932 = 1
endtry
call assert_equal(1, caught_932)
- call delete('Xscript')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim
index 9822e6f1b7..3f9bdd4db1 100644
--- a/src/testdir/test_let.vim
+++ b/src/testdir/test_let.vim
@@ -344,36 +344,31 @@ func Test_let_heredoc_fails()
let v =<< that there
endfunc
END
- call writefile(text, 'XheredocFail')
+ call writefile(text, 'XheredocFail', 'D')
call assert_fails('source XheredocFail', 'E1145:')
- call delete('XheredocFail')
let text =<< trim CodeEnd
func MissingEnd()
let v =<< END
endfunc
CodeEnd
- call writefile(text, 'XheredocWrong')
+ call writefile(text, 'XheredocWrong', 'D')
call assert_fails('source XheredocWrong', 'E1145:')
- call delete('XheredocWrong')
let text =<< trim TEXTend
let v =<< " comment
TEXTend
- call writefile(text, 'XheredocNoMarker')
+ call writefile(text, 'XheredocNoMarker', 'D')
call assert_fails('source XheredocNoMarker', 'E172:')
- call delete('XheredocNoMarker')
let text =<< trim TEXTend
let v =<< text
TEXTend
- call writefile(text, 'XheredocBadMarker')
+ call writefile(text, 'XheredocBadMarker', 'D')
call assert_fails('source XheredocBadMarker', 'E221:')
- call delete('XheredocBadMarker')
- call writefile(['let v =<< TEXT', 'abc'], 'XheredocMissingMarker')
+ call writefile(['let v =<< TEXT', 'abc'], 'XheredocMissingMarker', 'D')
call assert_fails('source XheredocMissingMarker', 'E990:')
- call delete('XheredocMissingMarker')
endfunc
func Test_let_heredoc_trim_no_indent_marker()
diff --git a/src/testdir/test_listchars.vim b/src/testdir/test_listchars.vim
index 0977543ba1..b9b078c0a1 100644
--- a/src/testdir/test_listchars.vim
+++ b/src/testdir/test_listchars.vim
@@ -664,7 +664,7 @@ func Test_listchars_foldcolumn()
vsplit
windo set signcolumn=yes foldcolumn=1 winminwidth=0 nowrap list listchars=extends:>,precedes:<
END
- call writefile(lines, 'XTest_listchars')
+ call writefile(lines, 'XTest_listchars', 'D')
let buf = RunVimInTerminal('-S XTest_listchars', {'rows': 10, 'cols': 60})
@@ -687,7 +687,6 @@ func Test_listchars_foldcolumn()
" clean up
call StopVimInTerminal(buf)
- call delete('XTest_listchars')
endfunc
diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim
index 2a08607ff1..2f9e21fb62 100644
--- a/src/testdir/test_lua.vim
+++ b/src/testdir/test_lua.vim
@@ -817,8 +817,7 @@ endfunc
" Test :luafile foo.lua
func Test_luafile()
- call delete('Xlua_file')
- call writefile(["str = 'hello'", "num = 123" ], 'Xlua_file')
+ call writefile(["str = 'hello'", "num = 123" ], 'Xlua_file', 'D')
call setfperm('Xlua_file', 'r-xr-xr-x')
luafile Xlua_file
@@ -826,7 +825,6 @@ func Test_luafile()
call assert_equal(123, luaeval('num'))
lua str, num = nil
- call delete('Xlua_file')
endfunc
" Test :luafile %
@@ -849,12 +847,11 @@ endfunc
" Test :luafile with syntax error
func Test_luafile_error()
new Xlua_file
- call writefile(['nil = 0' ], 'Xlua_file')
+ call writefile(['nil = 0' ], 'Xlua_file', 'D')
call setfperm('Xlua_file', 'r-xr-xr-x')
call assert_fails('luafile Xlua_file', "Xlua_file:1: unexpected symbol near 'nil'")
- call delete('Xlua_file')
bwipe!
endfunc
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index af14167d57..4181ce830e 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -758,7 +758,7 @@ func Test_popup_and_previewwindow_dump()
call setline(1, map(repeat(["ab"], 10), "v:val .. v:key"))
exec "norm! G\<C-E>\<C-E>"
END
- call writefile(lines, 'Xscript')
+ call writefile(lines, 'Xscript', 'D')
let buf = RunVimInTerminal('-S Xscript', {})
" wait for the script to finish
@@ -772,7 +772,6 @@ func Test_popup_and_previewwindow_dump()
call term_sendkeys(buf, "\<Esc>u")
call StopVimInTerminal(buf)
- call delete('Xscript')
endfunc
func Test_balloon_split()
@@ -829,7 +828,7 @@ func Test_popup_position()
123456789_123456789_123456789_b
123
END
- call writefile(lines, 'Xtest')
+ call writefile(lines, 'Xtest', 'D')
let buf = RunVimInTerminal('Xtest', {})
call term_sendkeys(buf, ":vsplit\<CR>")
@@ -860,7 +859,6 @@ func Test_popup_position()
call term_sendkeys(buf, "\<Esc>u")
call StopVimInTerminal(buf)
- call delete('Xtest')
endfunc
func Test_popup_command()
@@ -883,14 +881,14 @@ func Test_popup_command()
echomsg 'changed'
endfunc
END
- call writefile(script, 'XtimerScript')
+ call writefile(script, 'XtimerScript', 'D')
let lines =<< trim END
one two three four five
and one two Xthree four five
one more two three four five
END
- call writefile(lines, 'Xtest')
+ call writefile(lines, 'Xtest', 'D')
let buf = RunVimInTerminal('-S XtimerScript Xtest', {})
call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\<CR>")
call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>")
@@ -917,8 +915,6 @@ func Test_popup_command()
call VerifyScreenDump(buf, 'Test_popup_command_05', {})
call StopVimInTerminal(buf)
- call delete('Xtest')
- call delete('XtimerScript')
endfunc
func Test_popup_complete_backwards()
@@ -1013,7 +1009,7 @@ func Test_popup_complete_info_01()
inoremap <buffer><F6> <C-R>=s:complTestEval()<CR>
call writefile([
\ 'dummy dummy.txt 1',
- \], 'Xdummy.txt')
+ \], 'Xdummy.txt', 'D')
setlocal tags=Xdummy.txt
setlocal dictionary=Xdummy.txt
setlocal thesaurus=Xdummy.txt
@@ -1046,7 +1042,7 @@ func Test_popup_complete_info_01()
call assert_equal(mode_name, getline('.'))
%d
endfor
- call delete('Xdummy.txt')
+
bwipe!
endfunc
@@ -1194,7 +1190,7 @@ func Test_pum_rightleft()
vim
victory
END
- call writefile(lines, 'Xtest1')
+ call writefile(lines, 'Xtest1', 'D')
let buf = RunVimInTerminal('--cmd "set rightleft" Xtest1', {})
call term_sendkeys(buf, "Go\<C-P>")
call VerifyScreenDump(buf, 'Test_pum_rightleft_01', {'rows': 8})
@@ -1209,7 +1205,7 @@ func Test_pum_rightleft()
one three
four
END
- call writefile(lines, 'Xtest2')
+ call writefile(lines, 'Xtest2', 'D')
call term_sendkeys(buf, "\<Esc>:e! Xtest2\<CR>")
call TermWait(buf, 30)
call term_sendkeys(buf, "Goone\<C-X>\<C-L>")
@@ -1222,8 +1218,6 @@ func Test_pum_rightleft()
call WaitForAssert({-> assert_match('\s*eerht eno', Screenline(4))})
call StopVimInTerminal(buf)
- call delete('Xtest1')
- call delete('Xtest2')
endfunc
" Test for a popup menu with a scrollbar
@@ -1234,7 +1228,7 @@ func Test_pum_scrollbar()
two
three
END
- call writefile(lines, 'Xtest1')
+ call writefile(lines, 'Xtest1', 'D')
let buf = RunVimInTerminal('--cmd "set pumheight=2" Xtest1', {})
call TermWait(buf)
call term_sendkeys(buf, "Go\<C-P>\<C-P>\<C-P>")
@@ -1250,7 +1244,6 @@ func Test_pum_scrollbar()
endif
call StopVimInTerminal(buf)
- call delete('Xtest1')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 816dfb47f8..b0ed76be25 100644
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 625,
+/**/
624,
/**/
623,