1
0
forked from aniani/vim

patch 9.0.0766: too many delete() calls in tests

Problem:    Too many delete() calls in tests.
Solution:   Use deferred delete where possible.
This commit is contained in:
Bram Moolenaar
2022-10-15 20:06:33 +01:00
parent 36343ae0fb
commit 0e9bdad545
7 changed files with 156 additions and 287 deletions

View File

@@ -3490,7 +3490,7 @@ def Test_expr9_autoload_var()
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 @@ def Test_expr9_autoload_var()
v9.CheckDefExecAndScriptFailure(lines, 'E121: Undefined variable: autofile#other')
&rtp = save_rtp
delete('Xruntime', 'rf')
enddef
def Test_expr9_call_autoload()
@@ -3515,7 +3514,7 @@ def Test_expr9_call_autoload()
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 @@ def Test_expr9_call_autoload()
assert_equal('found', some#func())
&rtp = save_rtp
delete('Xruntime', 'rf')
enddef
def Test_expr9_method_call()
@@ -3640,7 +3638,7 @@ def Test_expr9_method_call_import()
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 @@ def Test_expr9_method_call_import()
echo range(5)->Xsquare.NoSuchFunc()
END
v9.CheckScriptFailure(lines, 'E1048: Item not found in script: NoSuchFunc')
delete('Xsquare.vim')
enddef