patch 9.0.0626: 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_match.vim b/src/testdir/test_match.vim
index 8be5bc0..1896158 100644
--- a/src/testdir/test_match.vim
+++ b/src/testdir/test_match.vim
@@ -372,12 +372,11 @@
call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
call matchaddpos('ErrorMsg', [[1, 51]])
END
- call writefile(lines, 'XscriptMatchLinebreak')
+ call writefile(lines, 'XscriptMatchLinebreak', 'D')
let buf = RunVimInTerminal('-S XscriptMatchLinebreak', #{rows: 10})
call VerifyScreenDump(buf, 'Test_match_linebreak', {})
call StopVimInTerminal(buf)
- call delete('XscriptMatchLinebreak')
endfunc
func Test_match_with_incsearch()
@@ -388,7 +387,7 @@
call setline(1, range(20))
call matchaddpos('ErrorMsg', [3])
END
- call writefile(lines, 'XmatchWithIncsearch')
+ call writefile(lines, 'XmatchWithIncsearch', 'D')
let buf = RunVimInTerminal('-S XmatchWithIncsearch', #{rows: 6})
call VerifyScreenDump(buf, 'Test_match_with_incsearch_1', {})
@@ -397,7 +396,6 @@
call term_sendkeys(buf, "\<CR>")
call StopVimInTerminal(buf)
- call delete('XmatchWithIncsearch')
endfunc
" Test for deleting matches outside of the screen redraw top/bottom lines
@@ -428,12 +426,11 @@
call setline(1, "\tix")
call matchadd('ErrorMsg', '\t')
END
- call writefile(lines, 'XscriptMatchTabLinebreak')
+ call writefile(lines, 'XscriptMatchTabLinebreak', 'D')
let buf = RunVimInTerminal('-S XscriptMatchTabLinebreak', #{rows: 10})
call VerifyScreenDump(buf, 'Test_match_tab_linebreak', {})
call StopVimInTerminal(buf)
- call delete('XscriptMatchTabLinebreak')
endfunc