diff src/testdir/test_match.vim @ 30582:72245f9c9405 v9.0.0626

patch 9.0.0626: too many delete() calls in tests Commit: https://github.com/vim/vim/commit/b152b6a40f729ed81a25d2fa541a4e73e201bec4 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 29 21:37:33 2022 +0100 patch 9.0.0626: 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 Thu, 29 Sep 2022 22:45:04 +0200
parents 66de6909e102
children a357a624e487
line wrap: on
line diff
--- a/src/testdir/test_match.vim
+++ b/src/testdir/test_match.vim
@@ -372,12 +372,11 @@ func Test_match_in_linebreak()
     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 @@ func Test_match_with_incsearch()
     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 @@ func Test_match_with_incsearch()
 
   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 @@ func Test_match_tab_with_linebreak()
     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