summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-15 20:52:26 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-15 20:52:26 +0100
commitc4860bdd2832feb7ab054c6dc14f68abe24c2373 (patch)
tree24422c7d419b358aea790c09da91344190728815 /src
parent0e9bdad545e8e75b23c40e44cc6ec51330f5b465 (diff)
downloadvim-git-c4860bdd2832feb7ab054c6dc14f68abe24c2373.tar.gz
patch 9.0.0767: too many delete() calls in testsv9.0.0767
Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test_tabline.vim4
-rw-r--r--src/testdir/test_tabpage.vim3
-rw-r--r--src/testdir/test_tagcase.vim3
-rw-r--r--src/testdir/test_tagfunc.vim3
-rw-r--r--src/testdir/test_tagjump.vim221
-rw-r--r--src/testdir/test_taglist.vim41
-rw-r--r--src/testdir/test_tcl.vim7
-rw-r--r--src/testdir/test_termencoding.vim3
-rw-r--r--src/testdir/test_terminal.vim61
-rw-r--r--src/testdir/test_terminal2.vim71
-rw-r--r--src/testdir/test_terminal3.vim33
-rw-r--r--src/testdir/test_timers.vim15
-rw-r--r--src/testdir/test_trycatch.vim15
-rw-r--r--src/version.c2
14 files changed, 169 insertions, 313 deletions
diff --git a/src/testdir/test_tabline.vim b/src/testdir/test_tabline.vim
index 556b85931..ab0268d65 100644
--- a/src/testdir/test_tabline.vim
+++ b/src/testdir/test_tabline.vim
@@ -154,10 +154,8 @@ func Test_mouse_click_in_tab()
set mouse=a
exe "norm \<LeftMouse>"
END
- call writefile(lines, 'Xclickscript')
+ call writefile(lines, 'Xclickscript', 'D')
call RunVim([], [], "-e -s -S Xclickscript -c qa")
-
- call delete('Xclickscript')
endfunc
diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim
index ef265edfb..e57a5dd0c 100644
--- a/src/testdir/test_tabpage.vim
+++ b/src/testdir/test_tabpage.vim
@@ -606,13 +606,12 @@ func Test_tabpage_cmdheight()
\ 'echo "hello\nthere"',
\ 'tabnext',
\ 'redraw',
- \ ], 'XTest_tabpage_cmdheight')
+ \ ], 'XTest_tabpage_cmdheight', 'D')
" Check that cursor line is concealed
let buf = RunVimInTerminal('-S XTest_tabpage_cmdheight', {'statusoff': 3})
call VerifyScreenDump(buf, 'Test_tabpage_cmdheight', {})
call StopVimInTerminal(buf)
- call delete('XTest_tabpage_cmdheight')
endfunc
" Test for closing the tab page from a command window
diff --git a/src/testdir/test_tagcase.vim b/src/testdir/test_tagcase.vim
index 4eecf9f23..f03a5fd35 100644
--- a/src/testdir/test_tagcase.vim
+++ b/src/testdir/test_tagcase.vim
@@ -1,7 +1,7 @@
" test 'tagcase' option
func Test_tagcase()
- call writefile(["Bar\tXtext\t3", "Foo\tXtext\t2", "foo\tXtext\t4"], 'Xtags')
+ call writefile(["Bar\tXtext\t3", "Foo\tXtext\t2", "foo\tXtext\t4"], 'Xtags', 'D')
set tags=Xtags
e Xtext
@@ -43,7 +43,6 @@ func Test_tagcase()
endfor
endfor
- call delete('Xtags')
set tags&
set ic&
setg tc&
diff --git a/src/testdir/test_tagfunc.vim b/src/testdir/test_tagfunc.vim
index 5b1897690..4eb0f39af 100644
--- a/src/testdir/test_tagfunc.vim
+++ b/src/testdir/test_tagfunc.vim
@@ -105,7 +105,7 @@ func Test_tagfunc_settagstack()
return [{'name' : 'mytag', 'filename' : 'Xtest', 'cmd' : '1'}]
endfunc
set tagfunc=Mytagfunc1
- call writefile([''], 'Xtest')
+ call writefile([''], 'Xtest', 'D')
call assert_fails('tag xyz', 'E986:')
func Mytagfunc2(pat, flags, info)
@@ -115,7 +115,6 @@ func Test_tagfunc_settagstack()
set tagfunc=Mytagfunc2
call assert_fails('tag xyz', 'E986:')
- call delete('Xtest')
set tagfunc&
delfunc Mytagfunc1
delfunc Mytagfunc2
diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim
index 59537ee29..5185b20b7 100644
--- a/src/testdir/test_tagjump.vim
+++ b/src/testdir/test_tagjump.vim
@@ -20,8 +20,8 @@ func Test_ptjump()
\ "one\tXptfile\t1",
\ "three\tXptfile\t3",
\ "two\tXptfile\t2"],
- \ 'Xpttags')
- call writefile(['one', 'two', 'three'], 'Xptfile')
+ \ 'Xpttags', 'D')
+ call writefile(['one', 'two', 'three'], 'Xptfile', 'D')
%bw!
ptjump two
@@ -48,8 +48,6 @@ func Test_ptjump()
call assert_equal(5, winheight(0))
close
- call delete('Xpttags')
- call delete('Xptfile')
set tags&
endfunc
@@ -60,14 +58,13 @@ func Test_cancel_ptjump()
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "word\tfile1\tcmd1",
\ "word\tfile2\tcmd2"],
- \ 'Xtags')
+ \ 'Xtags', 'D')
only!
call feedkeys(":ptjump word\<CR>\<CR>", "xt")
help
call assert_equal(2, winnr('$'))
- call delete('Xtags')
set tags&
quit
endfunc
@@ -77,7 +74,7 @@ func Test_static_tagjump()
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "one\tXtjfile1\t/^one/;\"\tf\tfile:\tsignature:(void)",
\ "word\tXtjfile2\tcmd2"],
- \ 'Xtjtags')
+ \ 'Xtjtags', 'D')
new Xtjfile1
call setline(1, ['empty', 'one()', 'empty'])
write
@@ -86,7 +83,6 @@ func Test_static_tagjump()
bwipe!
set tags&
- call delete('Xtjtags')
call delete('Xtjfile1')
endfunc
@@ -97,7 +93,7 @@ func Test_duplicate_tagjump()
\ "thesame\tXdtfile1\t2;\"\td\tfile:",
\ "thesame\tXdtfile1\t3;\"\td\tfile:",
\ ],
- \ 'Xdttags')
+ \ 'Xdttags', 'D')
new Xdtfile1
call setline(1, ['thesame one', 'thesame two', 'thesame three'])
write
@@ -110,7 +106,6 @@ func Test_duplicate_tagjump()
bwipe!
set tags&
- call delete('Xdttags')
call delete('Xdtfile1')
endfunc
@@ -121,8 +116,8 @@ func Test_tagjump_switchbuf()
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "second\tXsbfile1\t2",
\ "third\tXsbfile1\t3",],
- \ 'Xswtags')
- call writefile(['first', 'second', 'third'], 'Xsbfile1')
+ \ 'Xswtags', 'D')
+ call writefile(['first', 'second', 'third'], 'Xsbfile1', 'D')
enew | only
set switchbuf=
@@ -153,8 +148,6 @@ func Test_tagjump_switchbuf()
tabclose!
enew | only
- call delete('Xsbfile1')
- call delete('Xswtags')
set tags&
set switchbuf&vim
endfunc
@@ -168,13 +161,13 @@ function Test_keyword_jump()
\ " test text",
\ " start OK if found this line",
\ " start found wrong line",
- \ "test text"], 'Xtestfile')
+ \ "test text"], 'Xtestfile', 'D')
call writefile(["/* test text test tex start here",
\ " some text",
\ " test text",
\ " start OK if found this line",
\ " start found wrong line",
- \ "test text"], 'Xinclude')
+ \ "test text"], 'Xinclude', 'D')
new Xtestfile
call cursor(1,1)
call search("start")
@@ -189,8 +182,6 @@ function Test_keyword_jump()
call assert_fails('tag /\%(/', 'E426:')
enew! | only
- call delete('Xtestfile')
- call delete('Xinclude')
endfunction
" Test for jumping to a tag with 'hidden' set, with symbolic link in path of
@@ -205,9 +196,9 @@ func Test_tag_symbolic()
call writefile([
\ "SECTION_OFF " . getcwd() . "/Xtest.dir/Xtest.c /^#define SECTION_OFF 3$/",
\ '',
- \ ], 'Xsymtags')
+ \ ], 'Xsymtags', 'D')
call writefile(['#define SECTION_OFF 3',
- \ '#define NUM_SECTIONS 3'], 'Xtest.c')
+ \ '#define NUM_SECTIONS 3'], 'Xtest.c', 'D')
" Try jumping to a tag, but with a path that contains a symbolic link. When
" wrong, this will give the ATTENTION message. The next space will then be
@@ -223,8 +214,6 @@ func Test_tag_symbolic()
set hidden&
set tags&
enew!
- call delete('Xsymtags')
- call delete('Xtest.c')
call delete("Xtest.dir", "rf")
%bwipe!
endfunc
@@ -243,13 +232,13 @@ func Test_tag_file_encoding()
set encoding=utf8
let content = ['text for tags1', 'abcdefghijklmnopqrs']
- call writefile(content, 'Xtags1.txt')
+ call writefile(content, 'Xtags1.txt', 'D')
let content = ['text for tags2', 'ABC']
- call writefile(content, 'Xtags2.txt')
+ call writefile(content, 'Xtags2.txt', 'D')
let content = ['text for tags3', 'ABC']
- call writefile(content, 'Xtags3.txt')
+ call writefile(content, 'Xtags3.txt', 'D')
let content = ['!_TAG_FILE_ENCODING utf-8 //', 'abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs']
- call writefile(content, 'Xtags1')
+ call writefile(content, 'Xtags1', 'D')
" case1:
new
@@ -280,20 +269,15 @@ func Test_tag_file_encoding()
call add(contents, 'abc' .. i
\ .. " Xtags3.txt /\x82`\x82a\x82b")
endfor
- call writefile(contents, 'Xenctags')
+ call writefile(contents, 'Xenctags', 'D')
set tags=Xenctags
tag abc50
call assert_equal('Xtags3.txt', expand('%:t'))
call assert_equal('ABC', getline('.'))
- call delete('Xenctags')
close
set tags&
let &encoding = save_enc
- call delete('Xtags1.txt')
- call delete('Xtags2.txt')
- call delete('Xtags3.txt')
- call delete('Xtags1')
endfunc
" Test for emacs-style tags file (TAGS)
@@ -307,14 +291,14 @@ func Test_tagjump_etags()
\ "\tfoo();",
\ "\treturn 0;",
\ "}",
- \ ], 'Xmain.c')
+ \ ], 'Xmain.c', 'D')
call writefile([
\ "\x0c",
\ "Xmain.c,64",
\ "void foo() {}\x7ffoo\x011,0",
\ "int main(int argc, char **argv)\x7fmain\x012,14",
- \ ], 'Xtetags')
+ \ ], 'Xtetags', 'D')
set tags=Xtetags
ta foo
call assert_equal('void foo() {}', getline('.'))
@@ -333,7 +317,7 @@ func Test_tagjump_etags()
\ "\x0c",
\ "Xmain.c,64",
\ "int main(int argc, char **argv)\x7fmain\x012,14",
- \ ], 'Xtags2')
+ \ ], 'Xtags2', 'D')
tag main
call assert_equal(2, line('.'))
call assert_fails('tag bar', 'E426:')
@@ -383,18 +367,15 @@ func Test_tagjump_etags()
\ ], 'Xtags2')
call assert_fails('tag foo', 'E431:')
- call delete('Xtetags')
- call delete('Xtags2')
- call delete('Xmain.c')
set tags&
bwipe!
endfunc
" Test for getting and modifying the tag stack
func Test_getsettagstack()
- call writefile(['line1', 'line2', 'line3'], 'Xstsfile1')
- call writefile(['line1', 'line2', 'line3'], 'Xstsfile2')
- call writefile(['line1', 'line2', 'line3'], 'Xstsfile3')
+ call writefile(['line1', 'line2', 'line3'], 'Xstsfile1', 'D')
+ call writefile(['line1', 'line2', 'line3'], 'Xstsfile2', 'D')
+ call writefile(['line1', 'line2', 'line3'], 'Xstsfile3', 'D')
enew | only
call settagstack(1, {'items' : []})
@@ -414,7 +395,7 @@ func Test_getsettagstack()
\ "one\tXstsfile1\t1",
\ "three\tXstsfile3\t3",
\ "two\tXstsfile2\t2"],
- \ 'Xtsttags')
+ \ 'Xtsttags', 'D')
let stk = []
call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'one',
@@ -515,28 +496,24 @@ func Test_getsettagstack()
call assert_fails('call gettagstack()', 'E342:')
call settagstack(1, {'items' : []})
- call delete('Xstsfile1')
- call delete('Xstsfile2')
- call delete('Xstsfile3')
- call delete('Xtsttags')
set tags&
endfunc
func Test_tag_with_count()
call writefile([
\ 'test Xtest.h /^void test();$/;" p typeref:typename:void signature:()',
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
call writefile([
\ 'main Xtest.c /^int main()$/;" f typeref:typename:int signature:()',
\ 'test Xtest.c /^void test()$/;" f typeref:typename:void signature:()',
- \ ], 'Ytags')
+ \ ], 'Ytags', 'D')
cal writefile([
\ 'int main()',
\ 'void test()',
- \ ], 'Xtest.c')
+ \ ], 'Xtest.c', 'D')
cal writefile([
\ 'void test();',
- \ ], 'Xtest.h')
+ \ ], 'Xtest.h', 'D')
set tags=Xtags,Ytags
new Xtest.c
@@ -552,12 +529,8 @@ func Test_tag_with_count()
call assert_equal(bufname('%'), 'Xtest.h')
set tags&
- call delete('Xtags')
- call delete('Ytags')
bwipe Xtest.h
bwipe Xtest.c
- call delete('Xtest.h')
- call delete('Xtest.c')
endfunc
func Test_tagnr_recall()
@@ -565,14 +538,14 @@ func Test_tagnr_recall()
\ 'test Xtest.h /^void test();$/;" p',
\ 'main Xtest.c /^int main()$/;" f',
\ 'test Xtest.c /^void test()$/;" f',
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
cal writefile([
\ 'int main()',
\ 'void test()',
- \ ], 'Xtest.c')
+ \ ], 'Xtest.c', 'D')
cal writefile([
\ 'void test();',
- \ ], 'Xtest.h')
+ \ ], 'Xtest.h', 'D')
set tags=Xtags
new Xtest.c
@@ -588,17 +561,14 @@ func Test_tagnr_recall()
call assert_equal(bufname('%'), 'Xtest.h')
set tags&
- call delete('Xtags')
bwipe Xtest.h
bwipe Xtest.c
- call delete('Xtest.h')
- call delete('Xtest.c')
endfunc
func Test_tag_line_toolong()
call writefile([
\ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
set tags=Xtags
let old_vbs = &verbose
set verbose=5
@@ -635,7 +605,7 @@ func Test_tag_line_toolong()
\ 'two',
\ 'trhee',
\ 'four',
- \ ], 'Xsomewhere')
+ \ ], 'Xsomewhere', 'D')
tag foobar
call assert_equal('Xsomewhere', expand('%'))
call assert_equal(3, getcurpos()[1])
@@ -650,8 +620,6 @@ func Test_tag_line_toolong()
" Should not crash
call assert_true(v:true)
- call delete('Xtags')
- call delete('Xsomewhere')
set tags&
let &verbose = old_vbs
endfunc
@@ -665,16 +633,16 @@ func Test_tselect()
\ 'main Xtest.h /^void test();$/;" f',
\ 'main Xtest.c /^int main()$/;" f',
\ 'main Xtest.x /^void test()$/;" f',
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
cal writefile([
\ 'int main()',
\ 'void test()',
- \ ], 'Xtest.c')
+ \ ], 'Xtest.c', 'D')
let lines =<< trim [SCRIPT]
set tags=Xtags
[SCRIPT]
- call writefile(lines, 'XTest_tselect')
+ call writefile(lines, 'XTest_tselect', 'D')
let buf = RunVimInTerminal('-S XTest_tselect', {'rows': 10, 'cols': 50})
call TermWait(buf, 50)
@@ -682,22 +650,19 @@ func Test_tselect()
call VerifyScreenDump(buf, 'Test_tselect_1', {})
call StopVimInTerminal(buf)
- call delete('Xtags')
- call delete('Xtest.c')
- call delete('XTest_tselect')
endfunc
func Test_tagline()
call writefile([
\ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:1 language:Python class:Foo',
\ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:3 language:Python class:Bar',
- \], 'Xtags')
+ \], 'Xtags', 'D')
call writefile([
\ ' def provision(self, **kwargs):',
\ ' pass',
\ ' def provision(self, **kwargs):',
\ ' pass',
- \], 'Xtest.py')
+ \], 'Xtest.py', 'D')
set tags=Xtags
@@ -706,14 +671,12 @@ func Test_tagline()
2tag provision
call assert_equal(line('.'), 3)
- call delete('Xtags')
- call delete('Xtest.py')
set tags&
endfunc
" Test for expanding environment variable in a tag file name
func Test_tag_envvar()
- call writefile(["Func1\t$FOO\t/^Func1/"], 'Xtags')
+ call writefile(["Func1\t$FOO\t/^Func1/"], 'Xtags', 'D')
set tags=Xtags
let $FOO='TagTestEnv'
@@ -728,7 +691,6 @@ func Test_tag_envvar()
call assert_true(caught_exception)
set tags&
- call delete('Xtags')
unlet $FOO
endfunc
@@ -737,9 +699,9 @@ func Test_tag_preview()
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "second\tXtpfile1\t2",
\ "third\tXtpfile1\t3",],
- \ 'Xtags')
+ \ 'Xtags', 'D')
set tags=Xtags
- call writefile(['first', 'second', 'third'], 'Xtpfile1')
+ call writefile(['first', 'second', 'third'], 'Xtpfile1', 'D')
enew | only
ptag third
@@ -766,8 +728,6 @@ func Test_tag_preview()
pclose
call assert_equal(1, winnr('$'))
- call delete('Xtpfile1')
- call delete('Xtags')
set tags&
endfunc
@@ -778,7 +738,7 @@ func Test_tag_guess()
\ "func2\tXfoo\t/^int func2(int y)/",
\ "func3\tXfoo\t/^func3/",
\ "func4\tXfoo\t/^func4/"],
- \ 'Xtags')
+ \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
@@ -788,7 +748,7 @@ func Test_tag_guess()
int * func3 () { }
[CODE]
- call writefile(code, 'Xfoo')
+ call writefile(code, 'Xfoo', 'D')
let v:statusmsg = ''
ta func1
@@ -804,8 +764,6 @@ func Test_tag_guess()
call assert_equal(5, line('.'))
call assert_fails('ta func4', 'E434:')
- call delete('Xtags')
- call delete('Xfoo')
set tags&
endfunc
@@ -815,26 +773,23 @@ func Test_tag_sort()
\ "first\tXfoo\t1",
\ "ten\tXfoo\t3",
\ "six\tXfoo\t2"]
- call writefile(l, 'Xtags')
+ call writefile(l, 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int six() {}
int ten() {}
[CODE]
- call writefile(code, 'Xfoo')
+ call writefile(code, 'Xfoo', 'D')
call assert_fails('tag first', 'E432:')
" When multiple tag files are not sorted, then message should be displayed
" multiple times
- call writefile(l, 'Xtags2')
+ call writefile(l, 'Xtags2', 'D')
set tags=Xtags,Xtags2
call assert_fails('tag first', ['E432:', 'E432:'])
- call delete('Xtags')
- call delete('Xtags2')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
@@ -847,22 +802,20 @@ func Test_tag_fold()
\ "first\tXfoo\t1",
\ "second\tXfoo\t2",
\ "third\tXfoo\t3"],
- \ '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
tag second
call assert_equal('Xfoo', bufname(''))
call assert_equal(2, line('.'))
- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
@@ -874,14 +827,14 @@ func Test_ltag()
\ "first\tXfoo\t1",
\ "second\tXfoo\t/^int second() {}$/",
\ "third\tXfoo\t3"],
- \ '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
call setloclist(0, [], 'f')
@@ -899,8 +852,6 @@ func Test_ltag()
\ 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '', 'module': '',
\ 'text': 'second'}], getloclist(0))
- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
@@ -913,14 +864,14 @@ func Test_tag_last_search_pat()
\ "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
let save_cpo = &cpo
@@ -930,8 +881,6 @@ func Test_tag_last_search_pat()
call assert_equal('^int second() {}', @/)
let &cpo = save_cpo
- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
@@ -942,14 +891,14 @@ func Test_tag_stack()
for i in range(10, 31)
let l += ["var" .. i .. "\tXfoo\t/^int var" .. i .. ";$/"]
endfor
- call writefile(l, 'Xtags')
+ call writefile(l, 'Xtags', 'D')
set tags=Xtags
let l = []
for i in range(10, 31)
let l += ["int var" .. i .. ";"]
endfor
- call writefile(l, 'Xfoo')
+ call writefile(l, 'Xfoo', 'D')
" Jump to a tag when the tag stack is full. Oldest entry should be removed.
enew
@@ -994,8 +943,6 @@ func Test_tag_stack()
call settagstack(1, {'items' : []})
call assert_fails('pop', 'E73:')
- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
@@ -1007,14 +954,14 @@ func Test_tag_multimatch()
\ "first\tXfoo\t1",
\ "first\tXfoo\t2",
\ "first\tXfoo\t3"],
- \ 'Xtags')
+ \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int first() {}
int first() {}
[CODE]
- call writefile(code, 'Xfoo')
+ call writefile(code, 'Xfoo', 'D')
call settagstack(1, {'items' : []})
tag first
@@ -1041,8 +988,6 @@ func Test_tag_multimatch()
call assert_equal(1, line('.'))
set ignorecase&
- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
@@ -1054,14 +999,14 @@ func Test_preview_tag_multimatch()
\ "first\tXfoo\t1",
\ "first\tXfoo\t2",
\ "first\tXfoo\t3"],
- \ 'Xtags')
+ \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
int first() {}
int first() {}
[CODE]
- call writefile(code, 'Xfoo')
+ call writefile(code, 'Xfoo', 'D')
enew | only
ptag first
@@ -1091,8 +1036,6 @@ func Test_preview_tag_multimatch()
pclose
- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
@@ -1104,14 +1047,14 @@ func Test_tnext_multimatch()
\ "first\tXfoo1\t1",
\ "first\tXfoo2\t1",
\ "first\tXfoo3\t1"],
- \ 'Xtags')
+ \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
[CODE]
- call writefile(code, 'Xfoo1')
- call writefile(code, 'Xfoo2')
- call writefile(code, 'Xfoo3')
+ call writefile(code, 'Xfoo1', 'D')
+ call writefile(code, 'Xfoo2', 'D')
+ call writefile(code, 'Xfoo3', 'D')
tag first
tag first
@@ -1120,10 +1063,6 @@ func Test_tnext_multimatch()
tnext
call assert_fails('tnext', 'E428:')
- call delete('Xtags')
- call delete('Xfoo1')
- call delete('Xfoo2')
- call delete('Xfoo3')
set tags&
%bwipe
endfunc
@@ -1135,14 +1074,13 @@ func Test_multimatch_non_existing_files()
\ "first\tXfoo1\t1",
\ "first\tXfoo2\t1",
\ "first\tXfoo3\t1"],
- \ 'Xtags')
+ \ 'Xtags', 'D')
set tags=Xtags
call settagstack(1, {'items' : []})
call assert_fails('tag first', 'E429:')
call assert_equal(3, gettagstack().items[0].matchnr)
- call delete('Xtags')
set tags&
%bwipe
endfunc
@@ -1152,14 +1090,14 @@ func Test_tselect_listing()
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo\t1" .. ';"' .. "\tv\ttyperef:typename:int\tfile:",
\ "first\tXfoo\t2" .. ';"' .. "\tkind:v\ttyperef:typename:char\tfile:"],
- \ 'Xtags')
+ \ 'Xtags', 'D')
set tags=Xtags
let code =<< trim [CODE]
static int first;
static char first;
[CODE]
- call writefile(code, 'Xfoo')
+ call writefile(code, 'Xfoo', 'D')
call feedkeys("\<CR>", "t")
let l = split(execute("tselect first"), "\n")
@@ -1175,8 +1113,6 @@ Type number and <Enter> (q or empty cancels):
[DATA]
call assert_equal(expected, l)
- call delete('Xtags')
- call delete('Xfoo')
set tags&
%bwipe
endfunc
@@ -1454,9 +1390,9 @@ func Test_tag_length()
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "tame\tXtlfile1\t1;",
- \ "tape\tXtlfile2\t1;"], 'Xtags')
- call writefile(['tame'], 'Xtlfile1')
- call writefile(['tape'], 'Xtlfile2')
+ \ "tape\tXtlfile2\t1;"], 'Xtags', 'D')
+ call writefile(['tame'], 'Xtlfile1', 'D')
+ call writefile(['tape'], 'Xtlfile2', 'D')
" Jumping to the tag 'tape', should instead jump to 'tame'
new
@@ -1468,9 +1404,6 @@ func Test_tag_length()
tag /^tape$
call assert_equal('Xtlfile2', @%)
- call delete('Xtags')
- call delete('Xtlfile1')
- call delete('Xtlfile2')
set tags& taglength&
endfunc
@@ -1480,8 +1413,8 @@ func Test_tagfile_errors()
" missing search pattern or line number for a tag
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
- \ "foo\tXfile\t"], 'Xtags', 'b')
- call writefile(['foo'], 'Xfile')
+ \ "foo\tXfile\t"], 'Xtags', 'bD')
+ call writefile(['foo'], 'Xfile', 'D')
enew
tag foo
@@ -1504,8 +1437,6 @@ func Test_tagfile_errors()
\ "foo\tXfile 1;"], 'Xtags')
call assert_fails('tag foo', 'E431:')
- call delete('Xtags')
- call delete('Xfile')
set tags&
endfunc
@@ -1514,9 +1445,9 @@ func Test_stag_close_window_on_error()
new | only
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
- \ "foo\tXfile\t1"], 'Xtags')
- call writefile(['foo'], 'Xfile')
- call writefile([], '.Xfile.swp')
+ \ "foo\tXfile\t1"], 'Xtags', 'D')
+ call writefile(['foo'], 'Xfile', 'D')
+ call writefile([], '.Xfile.swp', 'D')
" Remove the catch-all that runtest.vim adds
au! SwapExists
augroup StagTest
@@ -1531,8 +1462,6 @@ func Test_stag_close_window_on_error()
augroup StagTest
au!
augroup END
- call delete('Xfile')
- call delete('.Xfile.swp')
set tags&
endfunc
@@ -1546,14 +1475,14 @@ func Test_tagbsearch()
\ "third\tXfoo\t3",
\ "second\tXfoo\t2",
\ "first\tXfoo\t1"],
- \ '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 tagbsearch
@@ -1613,8 +1542,6 @@ func Test_tagbsearch()
\ 'Xtags')
call assert_fails('tag bbb', 'E426:')
- call delete('Xtags')
- call delete('Xfoo')
set tags& tagbsearch&
endfunc
diff --git a/src/testdir/test_taglist.vim b/src/testdir/test_taglist.vim
index 23ef1078f..39e78bcb0 100644
--- a/src/testdir/test_taglist.vim
+++ b/src/testdir/test_taglist.vim
@@ -12,7 +12,7 @@ func Test_taglist()
\ "Kindly\tXbar\t3;\"\tv\tfile:",
\ "Lambda\tXbar\t3;\"\tλ\tfile:",
\ "Command\tXbar\tcall cursor(3, 4)|;\"\td",
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
set tags=Xtags
split Xtext
@@ -40,12 +40,11 @@ func Test_taglist()
" Use characters with value > 127 in the tag extra field.
call writefile([
\ "vFoo\tXfoo\t4" .. ';"' .. "\ttypename:int\ta£££\tv",
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
call assert_equal('v', taglist('vFoo')[0].kind)
call assert_fails("let l=taglist([])", 'E730:')
- call delete('Xtags')
set tags&
bwipe
endfunc
@@ -58,14 +57,13 @@ func Test_taglist_native_etags()
\ "src/os_unix.c,13491",
\ "set_signals(\x7f1335,32699",
\ "reset_signals(\x7f1407,34136",
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
set tags=Xtags
call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
- call delete('Xtags')
set tags&
endfunc
@@ -77,14 +75,13 @@ func Test_taglist_ctags_etags()
\ "src/os_unix.c,13491",
\ "set_signals(void)\x7fset_signals\x011335,32699",
\ "reset_signals(void)\x7freset_signals\x011407,34136",
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
set tags=Xtags
call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
- call delete('Xtags')
set tags&
endfunc
@@ -96,8 +93,8 @@ endfunc
func Test_tagfiles()
call assert_equal([], tagfiles())
- call writefile(["FFoo\tXfoo\t1"], 'Xtags1')
- call writefile(["FBar\tXbar\t1"], 'Xtags2')
+ call writefile(["FFoo\tXfoo\t1"], 'Xtags1', 'D')
+ call writefile(["FBar\tXbar\t1"], 'Xtags2', 'D')
set tags=Xtags1,Xtags2
call assert_equal(['Xtags1', 'Xtags2'], tagfiles())
@@ -111,22 +108,19 @@ func Test_tagfiles()
set tags&
call assert_equal([], tagfiles())
- call delete('Xtags1')
- call delete('Xtags2')
bd
endfunc
" For historical reasons we support a tags file where the last line is missing
" the newline.
func Test_tagsfile_without_trailing_newline()
- call writefile(["Foo\tfoo\t1"], 'Xtags', 'b')
+ call writefile(["Foo\tfoo\t1"], 'Xtags', 'bD')
set tags=Xtags
let tl = taglist('.*')
call assert_equal(1, len(tl))
call assert_equal('Foo', tl[0].name)
- call delete('Xtags')
set tags&
endfunc
@@ -136,7 +130,7 @@ func Test_tagfile_ignore_comments()
\ "!_TAG_PROGRAM_NAME /Test tags generator/",
\ "FBar\tXfoo\t2" .. ';"' .. "\textrafield\tf",
\ "!_TAG_FILE_FORMAT 2 /extended format/",
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
set tags=Xtags
let l = taglist('.*')
@@ -144,7 +138,6 @@ func Test_tagfile_ignore_comments()
call assert_equal('FBar', l[0].name)
set tags&
- call delete('Xtags')
endfunc
" Test for using an excmd in a tags file to position the cursor (instead of a
@@ -152,7 +145,7 @@ endfunc
func Test_tagfile_excmd()
call writefile([
\ "vFoo\tXfoo\tcall cursor(3, 4)" .. '|;"' .. "\tv",
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
set tags=Xtags
let l = taglist('.*')
@@ -164,14 +157,13 @@ func Test_tagfile_excmd()
\ 'filename' : 'Xfoo'}], l)
set tags&
- call delete('Xtags')
endfunc
" Test for duplicate fields in a tag in a tags file
func Test_duplicate_field()
call writefile([
\ "vFoo\tXfoo\t4" .. ';"' .. "\ttypename:int\ttypename:int\tv",
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
set tags=Xtags
let l = taglist('.*')
@@ -184,14 +176,13 @@ func Test_duplicate_field()
\ 'filename' : 'Xfoo'}], l)
set tags&
- call delete('Xtags')
endfunc
" Test for tag address with ;
func Test_tag_addr_with_semicolon()
call writefile([
\ "Func1\tXfoo\t6;/^Func1/" .. ';"' .. "\tf"
- \ ], 'Xtags')
+ \ ], 'Xtags', 'D')
set tags=Xtags
let l = taglist('.*')
@@ -203,12 +194,11 @@ func Test_tag_addr_with_semicolon()
\ 'filename' : 'Xfoo'}], l)
set tags&
- call delete('Xtags')
endfunc
" Test for format error in a tags file
func Test_format_error()
- call writefile(['vFoo-Xfoo-4'], 'Xtags')
+ call writefile(['vFoo-Xfoo-4'], 'Xtags', 'D')
set tags=Xtags
let caught_exception = v:false
@@ -228,12 +218,11 @@ func Test_format_error()
call assert_fails("echo taglist('foo')", 'E431:')
set tags&
- call delete('Xtags')
endfunc
" Test for :tag command completion with 'wildoptions' set to 'tagfile'
func Test_tag_complete_wildoptions()
- call writefile(["foo\ta.c\t10;\"\tf", "bar\tb.c\t20;\"\td"], 'Xtags')
+ call writefile(["foo\ta.c\t10;\"\tf", "bar\tb.c\t20;\"\td"], 'Xtags', 'D')
set tags=Xtags
set wildoptions=tagfile
@@ -242,7 +231,6 @@ func Test_tag_complete_wildoptions()
call assert_equal('"tag bar d b.c : foo f a.c', @:)
- call delete('Xtags')
set wildoptions&
set tags&
endfunc
@@ -256,7 +244,7 @@ func Test_tag_complete_with_overlong_line()
inboundGovernor a 2;" kind:⊢ type:forall (muxMode :: MuxMode) socket peerAddr versionNumber m a b. (MonadAsync m, MonadCatch m, MonadEvaluate m, MonadThrow m, MonadThrow (STM m), MonadTime m, MonadTimer m, MonadMask m, Ord peerAddr, HasResponder muxMode ~ True) => Tracer m (RemoteTransitionTrace peerAddr) -> Tracer m (InboundGovernorTrace peerAddr) -> ServerControlChannel muxMode peerAddr ByteString m a b -> DiffTime -> MuxConnectionManager muxMode socket peerAddr versionNumber ByteString m a b -> StrictTVar m InboundGovernorObservableState -> m Void
inboundGovernorCounters a 3;" kind:⊢ type:InboundGovernorState muxMode peerAddr m a b -> InboundGovernorCounters
END
- call writefile(tagslines, 'Xtags')
+ call writefile(tagslines, 'Xtags', 'D')
set tags=Xtags
" try with binary search
@@ -269,7 +257,6 @@ func Test_tag_complete_with_overlong_line()
call assert_equal('"tag inboundGSV inboundGovernor inboundGovernorCounters', @:)
set tagbsearch&
- call delete('Xtags')
set tags&
endfunc
diff --git a/src/testdir/test_tcl.vim b/src/testdir/test_tcl.vim
index bfd7013ed..4c6537fd7 100644
--- a/src/testdir/test_tcl.vim
+++ b/src/testdir/test_tcl.vim
@@ -684,25 +684,22 @@ endfunc
" Test :tclfile
func Test_tclfile()
call delete('Xtcl_file')
- call writefile(['set pi [format "%.2f" [expr acos(-1.0)]]'], 'Xtcl_file')
+ call writefile(['set pi [format "%.2f" [expr acos(-1.0)]]'], 'Xtcl_file', 'D')
call setfperm('Xtcl_file', 'r-xr-xr-x')
tclfile Xtcl_file
call assert_equal('3.14', TclEval('set pi'))
tcl unset pi
- call delete('Xtcl_file')
endfunc
" Test :tclfile with syntax error in tcl script
func Test_tclfile_error()
call delete('Xtcl_file')
- call writefile(['xyz'], 'Xtcl_file')
+ call writefile(['xyz'], 'Xtcl_file', 'D')
call setfperm('Xtcl_file', 'r-xr-xr-x')
call assert_fails('tclfile Xtcl_file', 'invalid command name "xyz"')
-
- call delete('Xtcl_file')
endfunc
" Test exiting current Tcl interpreter and re-creating one.
diff --git a/src/testdir/test_termencoding.vim b/src/testdir/test_termencoding.vim
index a1b604f5a..de812ce0a 100644
--- a/src/testdir/test_termencoding.vim
+++ b/src/testdir/test_termencoding.vim
@@ -26,14 +26,13 @@ func Test_termencoding_euc_jp()
\ 'scriptencoding utf-8',
\ 'exe "normal aE83: バッファを作成できないので、他のを使用します...\<Esc>"',
\ 'split Xeuc_jp.txt',
- \ ], 'XTest_tenc_euc_jp')
+ \ ], 'XTest_tenc_euc_jp', 'D')
let buf = RunVimInTerminal('-S XTest_tenc_euc_jp', {'rows': 10})
call VerifyScreenDump(buf, 'Test_tenc_euc_jp_01', {})
" clean up
call StopVimInTerminal(buf)
call delete('Xeuc_jp.txt')
- call delete('XTest_tenc_euc_jp')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index d0ffe3bdb..b0c29ecb2 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -405,7 +405,7 @@ func Test_terminal_scrape_123()
endfunc
func Test_terminal_scrape_multibyte()
- call writefile(["léttまrs"], 'Xtext')
+ call writefile(["léttまrs"], 'Xtext', 'D')
if has('win32')
" Run cmd with UTF-8 codepage to make the type command print the expected
" multibyte characters.
@@ -436,7 +436,6 @@ func Test_terminal_scrape_multibyte()
call TermWait(buf)
exe buf . 'bwipe'
- call delete('Xtext')
endfunc
func Test_terminal_one_column()
@@ -455,7 +454,7 @@ func Test_terminal_one_column()
endfunc
func Test_terminal_scroll()
- call writefile(range(1, 200), 'Xtext')
+ call writefile(range(1, 200), 'Xtext', 'D')
if has('win32')
let cmd = 'cmd /c "type Xtext"'
else
@@ -484,13 +483,12 @@ func Test_terminal_scroll()
call assert_equal('200', term_getline(buf, 200 - scrolled))
exe buf . 'bwipe'
- call delete('Xtext')
endfunc
func Test_terminal_scrollback()
let buf = Run_shell_in_terminal({'term_rows': 15})
set termwinscroll=100
- call writefile(range(150), 'Xtext')
+ call writefile(range(150), 'Xtext', 'D')
if has('win32')
call term_sendkeys(buf, "type Xtext\<CR>")
else
@@ -505,14 +503,13 @@ func Test_terminal_scrollback()
call StopShellInTerminal(buf)
exe buf . 'bwipe'
set termwinscroll&
- call delete('Xtext')
endfunc
func Test_terminal_postponed_scrollback()
" tail -f only works on Unix
CheckUnix
- call writefile(range(50), 'Xtext')
+ call writefile(range(50), 'Xtext', 'D')
call writefile([
\ 'set shell=/bin/sh noruler',
\ 'terminal',
@@ -520,7 +517,7 @@ func Test_terminal_postponed_scrollback()
\ 'call feedkeys("tail -n 100 -f Xtext\<CR>", "xt")',
\ 'sleep 100m',
\ 'call feedkeys("\<C-W>N", "xt")',
- \ ], 'XTest_postponed')
+ \ ], 'XTest_postponed', 'D')
let buf = RunVimInTerminal('-S XTest_postponed', {})
" Check that the Xtext lines are displayed and in Terminal-Normal mode
call VerifyScreenDump(buf, 'Test_terminal_scrollback_1', {})
@@ -547,8 +544,6 @@ func Test_terminal_postponed_scrollback()
echo type(tsk_ret)
call StopVimInTerminal(buf)
- call delete('XTest_postponed')
- call delete('Xtext')
endfunc
" Run diff on two dumps with different size.
@@ -783,10 +778,9 @@ endfunc
func Test_terminal_cwd_failure()
" Case 1: Provided directory is not actually a directory. Attempt to make
" the file executable as well.
- call writefile([], 'Xtcfile')
+ call writefile([], 'Xtcfile', 'D')
call setfperm('Xtcfile', 'rwx------')
call assert_fails("call term_start(&shell, {'cwd': 'Xtcfile'})", 'E475:')
- call delete('Xtcfile')
" Case 2: Directory does not exist.
call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:')
@@ -989,14 +983,13 @@ func Test_terminal_special_chars()
" this file name only works on Unix
CheckUnix
- call mkdir('Xdir with spaces')
+ call mkdir('Xdir with spaces', 'R')
call writefile(['x'], 'Xdir with spaces/quoted"file')
term ls Xdir\ with\ spaces/quoted\"file
call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))})
" make sure the job has finished
call WaitForAssert({-> assert_match('finish', term_getstatus(bufnr()))})
- call delete('Xdir with spaces', 'rf')
bwipe
endfunc
@@ -1040,14 +1033,13 @@ func Test_terminal_redir_file()
bwipe
if has('unix')
- call writefile(['one line'], 'Xtrfile')
+ call writefile(['one line'], 'Xtrfile', 'D')
let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xtrfile'})
call TermWait(buf)
call WaitForAssert({-> assert_equal('one line', term_getline(buf, 1))})
let g:job = term_getjob(buf)
call WaitForAssert({-> assert_equal('dead', job_status(g:job))})
bwipe
- call delete('Xtrfile')
endif
endfunc
@@ -1279,7 +1271,7 @@ func Test_aa_terminal_focus_events()
au FocusLost * call setline(1, 'I am lost') | set nomod
au FocusGained * call setline(1, 'I am back') | set nomod
END
- call writefile(lines, 'XtermFocus')
+ call writefile(lines, 'XtermFocus', 'D')
let buf = RunVimInTerminal('-S XtermFocus', #{rows: 6})
" Send a focus event to ourselves, it should be forwarded to the terminal
@@ -1297,7 +1289,6 @@ func Test_aa_terminal_focus_events()
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
- call delete('XtermFocus')
let &term = save_term
let &ttymouse = save_ttymouse
endfunc
@@ -1399,7 +1390,7 @@ func Test_terminal_exit()
close
call win_gotoid(termid)
END
- call writefile(lines, 'XtermExit')
+ call writefile(lines, 'XtermExit', 'D')
let buf = RunVimInTerminal('-S XtermExit', #{rows: 10})
let job = term_getjob(buf)
call WaitForAssert({-> assert_equal("run", job_status(job))})
@@ -1407,8 +1398,6 @@ func Test_terminal_exit()
" quit the shell, it will make Vim exit
call term_sendkeys(buf, "exit\<CR>")
call WaitForAssert({-> assert_equal("dead", job_status(job))})
-
- call delete('XtermExit')
endfunc
func Test_terminal_open_autocmd()
@@ -1455,7 +1444,7 @@ func Test_open_term_from_cmd()
set incsearch
cnoremap <F3> <Cmd>call term_start(['/bin/sh', '-c', ':'])<CR>
END
- call writefile(lines, 'Xopenterm')
+ call writefile(lines, 'Xopenterm', 'D')
let buf = RunVimInTerminal('-S Xopenterm', {})
" this opens a window, incsearch should not use the old cursor position
@@ -1465,18 +1454,17 @@ func Test_open_term_from_cmd()
call term_sendkeys(buf, ":q\<CR>")
call StopVimInTerminal(buf)
- call delete('Xopenterm')
endfunc
func Test_combining_double_width()
CheckUnix
CheckRunVimInTerminal
- call writefile(["\xe3\x83\x9b\xe3\x82\x9a"], 'Xonedouble')
+ call writefile(["\xe3\x83\x9b\xe3\x82\x9a"], 'Xonedouble', 'D')
let lines =<< trim END
call term_start(['/bin/sh', '-c', 'cat Xonedouble'])
END
- call writefile(lines, 'Xcombining')
+ call writefile(lines, 'Xcombining', 'D')
let buf = RunVimInTerminal('-S Xcombining', #{rows: 9})
" this opens a window, incsearch should not use the old cursor position
@@ -1484,8 +1472,6 @@ func Test_combining_double_width()
call term_sendkeys(buf, ":q\<CR>")
call StopVimInTerminal(buf)
- call delete('Xonedouble')
- call delete('Xcombining')
endfunc
func Test_terminal_popup_with_cmd()
@@ -1531,7 +1517,7 @@ func Test_terminal_popup_two_windows()
call term_sendkeys(termbuf, "echo 'test'")
END
- call writefile(lines, 'XpopupScript')
+ call writefile(lines, 'XpopupScript', 'D')
let buf = RunVimInTerminal('-S XpopupScript', {})
" typed text appears both in normal window and in popup
@@ -1542,7 +1528,6 @@ func Test_terminal_popup_two_windows()
call TermWait(buf)
call term_sendkeys(buf, ":q\<CR>")
call StopVimInTerminal(buf)
- call delete('XpopupScript')
endfunc
func Test_terminal_popup_insert_cmd()
@@ -1576,7 +1561,7 @@ func Test_terminal_dumpwrite_composing()
call assert_equal(1, winnr('$'))
let text = " a\u0300 e\u0302 o\u0308"
- call writefile([text], 'Xcomposing')
+ call writefile([text], 'Xcomposing', 'D')
let buf = RunVimInTerminal('--cmd "set encoding=utf-8" Xcomposing', {})
call WaitForAssert({-> assert_match(text, term_getline(buf, 1))})
eval 'Xdump'->term_dumpwrite(buf)
@@ -1584,7 +1569,6 @@ func Test_terminal_dumpwrite_composing()
call assert_match('|à| |ê| |ö', dumpline)
call StopVimInTerminal(buf)
- call delete('Xcomposing')
call delete('Xdump')
let &encoding = save_enc
endfunc
@@ -1647,12 +1631,11 @@ func Test_terminal_dumpload_dump()
let lines =<< trim END
call term_dumpload('dumps/Test_popupwin_22.dump', #{term_rows: 12})
END
- call writefile(lines, 'XtermDumpload')
+ call writefile(lines, 'XtermDumpload', 'D')
let buf = RunVimInTerminal('-S XtermDumpload', #{rows: 15})
call VerifyScreenDump(buf, 'Test_terminal_dumpload', {})
call StopVimInTerminal(buf)
- call delete('XtermDumpload')
endfunc
func Test_terminal_dumpdiff()
@@ -1667,9 +1650,8 @@ func Test_terminal_dumpdiff()
call assert_fails('call term_dumpdiff("X1.dump", [])', 'E730:')
call assert_fails('call term_dumpdiff("X1.dump", "X2.dump")', 'E485:')
- call writefile([], 'X1.dump')
+ call writefile([], 'X1.dump', 'D')
call assert_fails('call term_dumpdiff("X1.dump", "X2.dump")', 'E485:')
- call delete('X1.dump')
endfunc
func Test_terminal_dumpdiff_swap()
@@ -1766,7 +1748,7 @@ func Test_start_terminal_from_timer()
CheckFeature timers
" Open a terminal window from a timer, typed text goes to the terminal
- call writefile(["call timer_start(100, { -> term_start('sh') })"], 'XtimerTerm')
+ call writefile(["call timer_start(100, { -> term_start('sh') })"], 'XtimerTerm', 'D')
let buf = RunVimInTerminal('-S XtimerTerm', {})
call CheckTerminalWindowWorks(buf)
@@ -1775,7 +1757,6 @@ func Test_start_terminal_from_timer()
call CheckTerminalWindowWorks(buf)
call StopVimInTerminal(buf)
- call delete('XtimerTerm')
endfunc
func Test_terminal_window_focus()
@@ -1923,13 +1904,12 @@ func Test_terminal_api_drop_oldwin()
\ 'let &titlestring = ''["drop","Xtextfile"]''',
\ 'redraw',
\ "set t_ts=",
- \ ], 'Xscript')
+ \ ], 'Xscript', 'D')
let buf = RunVimInTerminal('-S Xscript', {'rows': 10})
call WaitForAssert({-> assert_equal('Xtextfile', expand('%:t'))})
call assert_equal(textfile_winid, win_getid())
call StopVimInTerminal(buf)
- call delete('Xscript')
bwipe Xtextfile
endfunc
@@ -2261,13 +2241,12 @@ func Test_terminal_all_ansi_colors()
\ 'call matchadd("TgreenBold", "Y")',
\ 'call matchadd("TmagentaBold", "Z")',
\ 'redraw',
- \ ], 'Xcolorscript')
+ \ ], 'Xcolorscript', 'D')
let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10})
call VerifyScreenDump(buf, 'Test_terminal_all_ansi_colors', {})
call term_sendkeys(buf, ":q\<CR>")
call StopVimInTerminal(buf)
- call delete('Xcolorscript')
endfunc
function On_BufFilePost()
diff --git a/src/testdir/test_terminal2.vim b/src/testdir/test_terminal2.vim
index 6e70ad6cc..c6acb99bc 100644
--- a/src/testdir/test_terminal2.vim
+++ b/src/testdir/test_terminal2.vim
@@ -19,7 +19,7 @@ func Test_terminal_termwinsize_option_fixed()
for n in range(10)
call add(text, repeat(n, 50))
endfor
- call writefile(text, 'Xwinsize')
+ call writefile(text, 'Xwinsize', 'D')
let buf = RunVimInTerminal('Xwinsize', {})
let win = bufwinid(buf)
call assert_equal([6, 40], term_getsize(buf))
@@ -34,7 +34,6 @@ func Test_terminal_termwinsize_option_fixed()
call assert_equal(60, winwidth(win))
call StopVimInTerminal(buf)
- call delete('Xwinsize')
call assert_fails('set termwinsize=40', 'E474:')
call assert_fails('set termwinsize=10+40', 'E474:')
@@ -192,7 +191,7 @@ func Test_terminal_out_err()
\ '#!/bin/sh',
\ 'echo "this is standard error" >&2',
\ 'echo "this is standard out" >&1',
- \ ], 'Xechoerrout.sh')
+ \ ], 'Xechoerrout.sh', 'D')
call setfperm('Xechoerrout.sh', 'rwxrwx---')
let outfile = 'Xtermstdout'
@@ -204,7 +203,6 @@ func Test_terminal_out_err()
call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
exe buf . 'bwipe'
- call delete('Xechoerrout.sh')
call delete(outfile)
endfunc
@@ -290,36 +288,34 @@ func Test_zz1_terminal_in_gui()
unlet g:job
endfunc
-" TODO: re-enable when this no longer hangs on Travis
-"func Test_zz2_terminal_guioptions_bang()
-" CheckGui
-" set guioptions+=!
-"
-" let filename = 'Xtestscript'
-" if has('win32')
-" let filename .= '.bat'
-" let prefix = ''
-" let contents = ['@echo off', 'exit %1']
-" else
-" let filename .= '.sh'
-" let prefix = './'
-" let contents = ['#!/bin/sh', 'exit $1']
-" endif
-" call writefile(contents, filename)
-" call setfperm(filename, 'rwxrwx---')
-"
-" " Check if v:shell_error is equal to the exit status.
-" let exitval = 0
-" execute printf(':!%s%s %d', prefix, filename, exitval)
-" call assert_equal(exitval, v:shell_error)
-"
-" let exitval = 9
-" execute printf(':!%s%s %d', prefix, filename, exitval)
-" call assert_equal(exitval, v:shell_error)
-"
-" set guioptions&
-" call delete(filename)
-"endfunc
+func Test_zz2_terminal_guioptions_bang()
+ CheckGui
+ set guioptions+=!
+
+ let filename = 'Xtestscript'
+ if has('win32')
+ let filename .= '.bat'
+ let prefix = ''
+ let contents = ['@echo off', 'exit %1']
+ else
+ let filename .= '.sh'
+ let prefix = './'
+ let contents = ['#!/bin/sh', 'exit $1']
+ endif
+ call writefile(contents, filename, 'D')
+ call setfperm(filename, 'rwxrwx---')
+
+ " Check if v:shell_error is equal to the exit status.
+ let exitval = 0
+ execute printf(':!%s%s %d', prefix, filename, exitval)
+ call assert_equal(exitval, v:shell_error)
+
+ let exitval = 9
+ execute printf(':!%s%s %d', prefix, filename, exitval)
+ call assert_equal(exitval, v:shell_error)
+
+ set guioptions&
+endfunc
func Test_terminal_hidden()
CheckUnix
@@ -372,7 +368,7 @@ func Test_terminal_normal_mode()
call setline(1, range(11111, 11122))
3
END
- call writefile(lines, 'XtermNormal')
+ call writefile(lines, 'XtermNormal', 'D')
let buf = RunVimInTerminal('-S XtermNormal', {'rows': 8})
call TermWait(buf)
@@ -389,7 +385,6 @@ func Test_terminal_normal_mode()
call assert_fails('call term_sendkeys(buf, [])', 'E730:')
call term_sendkeys(buf, "a:q!\<CR>:q\<CR>:q\<CR>")
call StopVimInTerminal(buf)
- call delete('XtermNormal')
endfunc
func Test_terminal_hidden_and_close()
@@ -415,7 +410,7 @@ func Test_terminal_does_not_truncate_last_newlines()
\ ]
for c in contents
- call writefile(c, 'Xdntfile')
+ call writefile(c, 'Xdntfile', 'D')
if has('win32')
term cmd /c type Xdntfile
else
@@ -428,8 +423,6 @@ func Test_terminal_does_not_truncate_last_newlines()
call assert_equal(c, getline(1, line('$')))
quit
endfor
-
- call delete('Xdntfile')
endfunc
func GetDummyCmd()
diff --git a/src/testdir/test_terminal3.vim b/src/testdir/test_terminal3.vim
index b798e9a0b..5b143719b 100644
--- a/src/testdir/test_terminal3.vim
+++ b/src/testdir/test_terminal3.vim
@@ -18,7 +18,7 @@ func Test_terminal_altscreen()
let cmd = "cat Xtext\<CR>"
let buf = term_start(&shell, {})
- call writefile(["\<Esc>[?1047h"], 'Xtext')
+ call writefile(["\<Esc>[?1047h"], 'Xtext', 'D')
call term_sendkeys(buf, cmd)
call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))})
@@ -28,7 +28,6 @@ func Test_terminal_altscreen()
call term_sendkeys(buf, "exit\r")
exe buf . "bwipe!"
- call delete('Xtext')
endfunc
func Test_terminal_shell_option()
@@ -79,7 +78,7 @@ func Terminal_color(group_name, highlight_cmds, highlight_opt, open_cmds)
\ ] + a:open_cmds + [
\ 'endfunc',
\ ] + a:highlight_cmds
- call writefile(lines, 'XtermStart')
+ call writefile(lines, 'XtermStart', 'D')
let buf = RunVimInTerminal('-S XtermStart', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm()\<CR>")
@@ -90,7 +89,6 @@ func Terminal_color(group_name, highlight_cmds, highlight_opt, open_cmds)
call term_sendkeys(buf, "\<C-D>")
call TermWait(buf, 50)
call StopVimInTerminal(buf)
- call delete('XtermStart')
endfunc
func Test_terminal_color_Terminal()
@@ -143,7 +141,7 @@ func Test_terminal_color_wincolor_split()
\ 'highlight MyWinCol ctermfg=red ctermbg=darkyellow',
\ 'highlight MyWinCol2 ctermfg=black ctermbg=blue',
\ ]
- call writefile(lines, 'XtermStart')
+ call writefile(lines, 'XtermStart', 'D')
let buf = RunVimInTerminal('-S XtermStart', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm()\<CR>")
@@ -162,7 +160,6 @@ func Test_terminal_color_wincolor_split()
call term_sendkeys(buf, "\<C-D>")
call TermWait(buf, 50)
call StopVimInTerminal(buf)
- call delete('XtermStart')
endfunc
func Test_terminal_color_transp_Terminal()
@@ -245,7 +242,7 @@ func Test_terminal_in_popup()
to edit
in a popup window
END
- call writefile(text, 'Xtext')
+ call writefile(text, 'Xtext', 'D')
let cmd = GetVimCommandCleanTerm()
let lines = [
\ 'call setline(1, range(20))',
@@ -268,7 +265,7 @@ func Test_terminal_in_popup()
\ ' call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})',
\ 'endfunc',
\ ]
- call writefile(lines, 'XtermPopup')
+ call writefile(lines, 'XtermPopup', 'D')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":call OpenTerm(0)\<CR>")
@@ -312,8 +309,6 @@ func Test_terminal_in_popup()
call TermWait(buf, 250) " wait for terminal to vanish
call StopVimInTerminal(buf)
- call delete('Xtext')
- call delete('XtermPopup')
endfunc
" Check a terminal in popup window uses the default minimum size.
@@ -325,7 +320,7 @@ func Test_terminal_in_popup_min_size()
to show
in a popup window
END
- call writefile(text, 'Xtext')
+ call writefile(text, 'Xtext', 'D')
let lines = [
\ 'call setline(1, range(20))',
\ 'func OpenTerm()',
@@ -333,7 +328,7 @@ func Test_terminal_in_popup_min_size()
\ ' let g:winid = popup_create(s:buf, #{ border: []})',
\ 'endfunc',
\ ]
- call writefile(lines, 'XtermPopup')
+ call writefile(lines, 'XtermPopup', 'D')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":set noruler\<CR>")
@@ -346,8 +341,6 @@ func Test_terminal_in_popup_min_size()
call term_sendkeys(buf, ":q\<CR>")
call TermWait(buf, 50) " wait for terminal to vanish
call StopVimInTerminal(buf)
- call delete('Xtext')
- call delete('XtermPopup')
endfunc
" Check a terminal in popup window with different colors
@@ -365,7 +358,7 @@ func Terminal_in_popup_color(group_name, highlight_cmds, highlight_opt, popup_cm
\ ] + a:popup_cmds + [
\ 'endfunc',
\ ] + a:highlight_cmds
- call writefile(lines, 'XtermPopup')
+ call writefile(lines, 'XtermPopup', 'D')
let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
call TermWait(buf, 100)
call term_sendkeys(buf, ":set noruler\<CR>")
@@ -379,7 +372,6 @@ func Terminal_in_popup_color(group_name, highlight_cmds, highlight_opt, popup_cm
call term_sendkeys(buf, ":q\<CR>")
call TermWait(buf, 50) " wait for terminal to vanish
call StopVimInTerminal(buf)
- call delete('XtermPopup')
endfunc
func Test_terminal_in_popup_color_Terminal()
@@ -582,7 +574,7 @@ func Test_term_and_startinsert()
term
startinsert
EOL
- call writefile(lines, 'XTest_startinsert')
+ call writefile(lines, 'XTest_startinsert', 'D')
let buf = RunVimInTerminal('-S XTest_startinsert', {})
call term_sendkeys(buf, "exit\r")
@@ -592,7 +584,6 @@ func Test_term_and_startinsert()
call WaitForAssert({-> assert_equal("some text<", term_getline(buf, 1))})
call StopVimInTerminal(buf)
- call delete('XTest_startinsert')
endfunc
" Test for passing invalid arguments to terminal functions
@@ -683,7 +674,7 @@ func Test_term_mouse()
red green yellow red blue
vim emacs sublime nano
END
- call writefile(lines, 'Xtest_mouse')
+ call writefile(lines, 'Xtest_mouse', 'D')
" Create a terminal window running Vim for the test with mouse enabled
let prev_win = win_getid()
@@ -783,7 +774,6 @@ func Test_term_mouse()
let &ttymouse = save_ttymouse
let &clipboard = save_clipboard
set mousetime&
- call delete('Xtest_mouse')
call delete('Xbuf')
endfunc
@@ -836,7 +826,7 @@ func Test_term_modeless_selection()
red green yellow red blue
vim emacs sublime nano
END
- call writefile(lines, 'Xtest_modeless')
+ call writefile(lines, 'Xtest_modeless', 'D')
" Create a terminal window running Vim for the test with mouse disabled
let prev_win = win_getid()
@@ -869,7 +859,6 @@ func Test_term_modeless_selection()
let &term = save_term
let &ttymouse = save_ttymouse
set mousetime& clipboard&
- call delete('Xtest_modeless')
new | only!
endfunc
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim
index 1b996c523..8e6d7f943 100644
--- a/src/testdir/test_timers.vim
+++ b/src/testdir/test_timers.vim
@@ -371,12 +371,12 @@ func Test_timer_restore_count()
\ ' normal 3j',
\ 'endfunc',
\ 'call timer_start(100, "Doit")',
- \ ], 'Xtrcscript')
+ \ ], 'Xtrcscript', 'D')
call writefile([
\ '1-1234',
\ '2-1234',
\ '3-1234',
- \ ], 'Xtrctext')
+ \ ], 'Xtrctext', 'D')
let buf = RunVimInTerminal('-S Xtrcscript Xtrctext', {})
" Wait for the timer to move the cursor to the third line.
@@ -387,8 +387,6 @@ func Test_timer_restore_count()
call WaitForAssert({-> assert_equal(2, term_getcursor(buf)[1])})
call StopVimInTerminal(buf)
- call delete('Xtrcscript')
- call delete('Xtrctext')
endfunc
" Test that the garbage collector isn't triggered if a timer callback invokes
@@ -438,7 +436,7 @@ func Test_timer_error_in_timer_callback()
set updatetime=50
call timer_start(1, 'Func')
[CODE]
- call writefile(lines, 'Xtest.vim')
+ call writefile(lines, 'Xtest.vim', 'D')
let buf = term_start(GetVimCommandCleanTerm() .. ' -S Xtest.vim', {'term_rows': 8})
let job = term_getjob(buf)
@@ -456,7 +454,6 @@ func Test_timer_error_in_timer_callback()
call assert_equal('', job_info(job).termsig)
endif
- call delete('Xtest.vim')
exe buf .. 'bwipe!'
endfunc
@@ -485,7 +482,7 @@ func Test_timer_changing_function_list()
endfor
au CmdlineLeave : call timer_start(0, {-> 0})
END
- call writefile(lines, 'XTest_timerchange')
+ call writefile(lines, 'XTest_timerchange', 'D')
let buf = RunVimInTerminal('-S XTest_timerchange', #{rows: 10})
call term_sendkeys(buf, ":fu\<CR>")
call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 10))})
@@ -494,7 +491,6 @@ func Test_timer_changing_function_list()
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
- call delete('XTest_timerchange')
endfunc
func Test_timer_outputting_message()
@@ -508,7 +504,7 @@ func Test_timer_outputting_message()
echon repeat('x', &columns - 11)
})
END
- call writefile(lines, 'XTest_timermessage')
+ call writefile(lines, 'XTest_timermessage', 'D')
let buf = RunVimInTerminal('-S XTest_timermessage', #{rows: 6})
call term_sendkeys(buf, "l")
call term_wait(buf)
@@ -516,7 +512,6 @@ func Test_timer_outputting_message()
call WaitForAssert({-> assert_match('xxxxxxxxxxx', term_getline(buf, 6))})
call StopVimInTerminal(buf)
- call delete('XTest_timermessage')
endfunc
func Test_timer_using_win_execute_undo_sync()
diff --git a/src/testdir/test_trycatch.vim b/src/testdir/test_trycatch.vim
index 28cd39f04..9d6208455 100644
--- a/src/testdir/test_trycatch.vim
+++ b/src/testdir/test_trycatch.vim
@@ -1975,7 +1975,7 @@ func Test_builtin_func_error()
endfunc
func Test_reload_in_try_catch()
- call writefile(['x'], 'Xreload')
+ call writefile(['x'], 'Xreload', 'D')
set autoread
edit Xreload
tabnew
@@ -1995,7 +1995,6 @@ func Test_reload_in_try_catch()
autocmd! ReLoad
set noautoread
bwipe! Xreload
- call delete('Xreload')
endfunc
" Test for errors with :catch, :throw, :finally {{{1
@@ -2306,10 +2305,8 @@ func Test_user_command_function_call_with_endtry()
call s:main()
call assert_equal('yes', s:caught)
END
- call writefile(lines, 'XtestThrow')
+ call writefile(lines, 'XtestThrow', 'D')
source XtestThrow
-
- call delete('XtestThrow')
endfunc
func ThisWillFail()
@@ -2325,13 +2322,11 @@ func Test_error_in_catch_and_finally()
for l in []
finally
END
- call writefile(lines, 'XtestCatchAndFinally')
+ call writefile(lines, 'XtestCatchAndFinally', 'D')
try
source XtestCatchAndFinally
catch /E600:/
endtry
-
- call delete('XtestCatchAndFinally')
endfunc
" This was causing an illegal memory access
@@ -2345,13 +2340,11 @@ func Test_leave_block_in_endtry_not_called()
if
endtry
END
- call writefile(lines, 'XtestEndtry')
+ call writefile(lines, 'XtestEndtry', 'D')
try
source XtestEndtry
catch /E171:/
endtry
-
- call delete('XtestEndtry')
endfunc
" Modeline {{{1
diff --git a/src/version.c b/src/version.c
index ee6c70ff9..997aad32f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 767,
+/**/
766,
/**/
765,