patch 9.0.0766: 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_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 44e221a..b764e92 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -3490,7 +3490,7 @@
var auto_lines =<< trim END
let autofile#var = 'found'
END
- mkdir('Xruntime/autoload', 'p')
+ mkdir('Xruntime/autoload', 'pR')
writefile(auto_lines, 'Xruntime/autoload/autofile.vim')
var save_rtp = &rtp
&rtp = getcwd() .. '/Xruntime,' .. &rtp
@@ -3506,7 +3506,6 @@
v9.CheckDefExecAndScriptFailure(lines, 'E121: Undefined variable: autofile#other')
&rtp = save_rtp
- delete('Xruntime', 'rf')
enddef
def Test_expr9_call_autoload()
@@ -3515,7 +3514,7 @@
return 'found'
enddef
END
- mkdir('Xruntime/autoload', 'p')
+ mkdir('Xruntime/autoload', 'pR')
writefile(auto_lines, 'Xruntime/autoload/some.vim')
var save_rtp = &rtp
&rtp = getcwd() .. '/Xruntime,' .. &rtp
@@ -3523,7 +3522,6 @@
assert_equal('found', some#func())
&rtp = save_rtp
- delete('Xruntime', 'rf')
enddef
def Test_expr9_method_call()
@@ -3640,7 +3638,7 @@
return map(items, (_, i) => i * i)
enddef
END
- call writefile(lines, 'Xsquare.vim')
+ call writefile(lines, 'Xsquare.vim', 'D')
lines =<< trim END
vim9script
@@ -3663,8 +3661,6 @@
echo range(5)->Xsquare.NoSuchFunc()
END
v9.CheckScriptFailure(lines, 'E1048: Item not found in script: NoSuchFunc')
-
- delete('Xsquare.vim')
enddef