patch 9.0.0719: too many delete() calls in tests
Problem: Too many delete() calls in tests.
Solution: Use deferred delete where possible.
diff --git a/src/testdir/test_scriptnames.vim b/src/testdir/test_scriptnames.vim
index b558af5..3f81349 100644
--- a/src/testdir/test_scriptnames.vim
+++ b/src/testdir/test_scriptnames.vim
@@ -1,7 +1,7 @@
" Test for the :scriptnames command
func Test_scriptnames()
- call writefile(['let did_load_script = 123'], 'Xscripting')
+ call writefile(['let did_load_script = 123'], 'Xscripting', 'D')
source Xscripting
call assert_equal(123, g:did_load_script)
@@ -22,7 +22,6 @@
call assert_equal('Xscripting', expand('%:t'))
bwipe
- call delete('Xscripting')
let msgs = execute('messages')
scriptnames
@@ -47,7 +46,7 @@
def Xscript_def_func2()
enddef
END
- call writefile(lines, 'X22script91')
+ call writefile(lines, 'X22script91', 'D')
source X22script91
let l = getscriptinfo()
call assert_match('X22script91$', l[-1].name)
@@ -92,8 +91,6 @@
call assert_fails("echo getscriptinfo('foobar')", 'E1206:')
call assert_fails("echo getscriptinfo({'sid': []})", 'E745:')
-
- call delete('X22script91')
endfunc
" vim: shiftwidth=2 sts=2 expandtab