diff src/testdir/test_window_cmd.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 fe0a18141c3c
children 62a42d860d87
line wrap: on
line diff
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -69,8 +69,8 @@ endfunc
 func Test_window_cmd_wincmd_gf()
   let fname = 'test_gf.txt'
   let swp_fname = '.' . fname . '.swp'
-  call writefile([], fname)
-  call writefile([], swp_fname)
+  call writefile([], fname, 'D')
+  call writefile([], swp_fname, 'D')
   function s:swap_exists()
     let v:swapchoice = s:swap_choice
   endfunc
@@ -96,8 +96,6 @@ func Test_window_cmd_wincmd_gf()
   call assert_notequal(fname, bufname("%"))
   new | only!
 
-  call delete(fname)
-  call delete(swp_fname)
   augroup! test_window_cmd_wincmd_gf
 endfunc
 
@@ -740,7 +738,7 @@ func Test_window_prevwin()
   CheckUnix
 
   set hidden autoread
-  call writefile(['2'], 'tmp.txt')
+  call writefile(['2'], 'tmp.txt', 'D')
   new tmp.txt
   q
   call Fun_RenewFile()
@@ -756,7 +754,6 @@ func Test_window_prevwin()
   wincmd p
   " reset
   q
-  call delete('tmp.txt')
   set hidden&vim autoread&vim
   delfunc Fun_RenewFile
 endfunc
@@ -1082,9 +1079,9 @@ func Run_noroom_for_newwindow_test(dir_a
     endtry
   endwhile
 
-  call writefile(['first', 'second', 'third'], 'Xnorfile1')
-  call writefile([], 'Xnorfile2')
-  call writefile([], 'Xnorfile3')
+  call writefile(['first', 'second', 'third'], 'Xnorfile1', 'D')
+  call writefile([], 'Xnorfile2', 'D')
+  call writefile([], 'Xnorfile3', 'D')
 
   " Argument list related commands
   args Xnorfile1 Xnorfile2 Xnorfile3
@@ -1165,9 +1162,6 @@ func Run_noroom_for_newwindow_test(dir_a
   endif
 
   %bwipe!
-  call delete('Xnorfile1')
-  call delete('Xnorfile2')
-  call delete('Xnorfile3')
   only
 endfunc