patch 9.0.0769: 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_xxd.vim b/src/testdir/test_xxd.vim
index b27639d..b79d52a 100644
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -274,8 +274,8 @@
func Test_xxd_patch()
let cmd1 = 'silent !' .. s:xxd_cmd .. ' -r Xxxdin Xxxdfile'
let cmd2 = 'silent !' .. s:xxd_cmd .. ' -g1 Xxxdfile > Xxxdout'
- call writefile(["2: 41 41", "8: 42 42"], 'Xxxdin')
- call writefile(['::::::::'], 'Xxxdfile')
+ call writefile(["2: 41 41", "8: 42 42"], 'Xxxdin', 'D')
+ call writefile(['::::::::'], 'Xxxdfile', 'D')
exe cmd1
exe cmd2
call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout'))
@@ -306,8 +306,6 @@
exe cmd2
call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 42 44 46 46 ::EE::::BDFF'], readfile('Xxxdout'))
- call delete('Xxxdin')
- call delete('Xxxdfile')
call delete('Xxxdout')
endfunc
@@ -369,7 +367,7 @@
" -c0 selects the format specific default column value, as if no -c was given
" except for -ps, where it disables extra newlines
func Test_xxd_c0_is_def_cols()
- call writefile(["abcdefghijklmnopqrstuvwxyz0123456789"], 'Xxdin')
+ call writefile(["abcdefghijklmnopqrstuvwxyz0123456789"], 'Xxdin', 'D')
for cols in ['-c0', '-c 0', '-cols 0']
for fmt in ['', '-b', '-e', '-i']
exe 'r! ' . s:xxd_cmd . ' ' . fmt ' Xxdin > Xxdout1'
@@ -377,7 +375,6 @@
call assert_equalfile('Xxdout1', 'Xxdout2')
endfor
endfor
- call delete('Xxdin')
call delete('Xxdout1')
call delete('Xxdout2')
endfunc
@@ -391,7 +388,7 @@
\ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
\ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
\ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"],
- \ 'Xxdin')
+ \ 'Xxdin', 'D')
for cols in ['-c0', '-c 0', '-cols 0']
exe 'r! ' . s:xxd_cmd . ' -ps ' . cols ' Xxdin'
" output seems to start in line 2
@@ -402,7 +399,6 @@
" xxd output must be non-empty and comprise only lower case hex digits
call assert_match("^[0-9a-f][0-9a-f]*$", out)
endfor
- call delete('Xxdin')
endfunc
" vim: shiftwidth=2 sts=2 expandtab