diff src/testdir/test_vim9_cmd.vim @ 30863:b4b51e01dd36 v9.0.0766

patch 9.0.0766: too many delete() calls in tests Commit: https://github.com/vim/vim/commit/0e9bdad545e8e75b23c40e44cc6ec51330f5b465 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 15 20:06:33 2022 +0100 patch 9.0.0766: 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 21:15:03 +0200
parents 58fb880f3607
children 360f286b5869
line wrap: on
line diff
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -120,12 +120,11 @@ def Test_cmdmod_execute()
       vim9script
       export var exported = 'x'
   END
-  writefile(lines, 'Xvim9import.vim')
+  writefile(lines, 'Xvim9import.vim', 'D')
   lines =<< trim END
       legacy exe "import './Xvim9import.vim'"
   END
   v9.CheckScriptSuccess(lines)
-  delete('Xvim9import.vim')
 
   # "legacy" does not aply to a called function
   lines =<< trim END
@@ -331,7 +330,7 @@ def Test_hardcopy_wildcards()
 enddef
 
 def Test_syn_include_wildcards()
-  writefile(['syn keyword Found found'], 'Xthemine.vim')
+  writefile(['syn keyword Found found'], 'Xthemine.vim', 'D')
   var save_rtp = &rtp
   &rtp = '.'
 
@@ -340,7 +339,6 @@ def Test_syn_include_wildcards()
   assert_match('Found.* contained found', execute('syn list Found'))
 
   &rtp = save_rtp
-  delete('Xthemine.vim')
 enddef
 
 def Test_echo_linebreak()
@@ -932,7 +930,7 @@ func Test_command_modifier_confirm()
       confirm write Xcmodfile
     enddef
   END
-  call writefile(lines, 'Xconfirmscript')
+  call writefile(lines, 'Xconfirmscript', 'D')
   call writefile(['empty'], 'Xcmodfile')
   let buf = RunVimInTerminal('-S Xconfirmscript', {'rows': 8})
   call term_sendkeys(buf, ":call Getout()\n")
@@ -946,7 +944,6 @@ func Test_command_modifier_confirm()
   call assert_equal(['changed'], readfile('Xcmodfile'))
   call delete('Xcmodfile')
   call delete('.Xcmodfile.swp')  " in case Vim was killed
-  call delete('Xconfirmscript')
 endfunc
 
 def Test_command_modifiers_keep()