diff src/testdir/test_xxd.vim @ 30869:bff3fa5f4c74 v9.0.0769

patch 9.0.0769: too many delete() calls in tests Commit: https://github.com/vim/vim/commit/db4c94788ad70118fa1ccc5fbc821757350ac771 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 15 22:06:06 2022 +0100 patch 9.0.0769: too many delete() calls in tests Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Oct 2022 23:15:04 +0200
parents 948c947cb1ed
children dbec60b8c253
line wrap: on
line diff
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -274,8 +274,8 @@ endfunc
 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 @@ func Test_xxd_patch()
   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 @@ endfunc
 " -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 @@ func Test_xxd_c0_is_def_cols()
       call assert_equalfile('Xxdout1', 'Xxdout2')
     endfor
   endfor
-  call delete('Xxdin')
   call delete('Xxdout1')
   call delete('Xxdout2')
 endfunc
@@ -391,7 +388,7 @@ func Test_xxd_plain_one_line()
         \ "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 @@ func Test_xxd_plain_one_line()
     " 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