patch 9.0.0619: 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_highlight.vim b/src/testdir/test_highlight.vim
index ef9c70e..26426e0 100644
--- a/src/testdir/test_highlight.vim
+++ b/src/testdir/test_highlight.vim
@@ -540,7 +540,7 @@
call writefile([
\ 'set cul rnu',
\ 'call setline(1, ["","1","2","3",""])',
- \ ], 'Xtest_cursorline_yank')
+ \ ], 'Xtest_cursorline_yank', 'D')
let buf = RunVimInTerminal('-S Xtest_cursorline_yank', {'rows': 8})
call TermWait(buf)
call term_sendkeys(buf, "Gy3k")
@@ -551,7 +551,6 @@
" clean up
call StopVimInTerminal(buf)
- call delete('Xtest_cursorline_yank')
endfunc
" test for issue #4862
@@ -580,7 +579,7 @@
call writefile([
\ 'set cul',
\ 'call setline(1, repeat(["abc"], 50))',
- \ ], 'Xtest_cursorline_with_visualmode')
+ \ ], 'Xtest_cursorline_with_visualmode', 'D')
let buf = RunVimInTerminal('-S Xtest_cursorline_with_visualmode', {'rows': 12})
call TermWait(buf)
call term_sendkeys(buf, "V\<C-f>kkkjk")
@@ -589,7 +588,6 @@
" clean up
call StopVimInTerminal(buf)
- call delete('Xtest_cursorline_with_visualmode')
endfunc
func Test_cursorcolumn_insert_on_tab()
@@ -600,7 +598,7 @@
set cursorcolumn
call cursor(2, 2)
END
- call writefile(lines, 'Xcuc_insert_on_tab')
+ call writefile(lines, 'Xcuc_insert_on_tab', 'D')
let buf = RunVimInTerminal('-S Xcuc_insert_on_tab', #{rows: 8})
call TermWait(buf)
@@ -619,7 +617,6 @@
call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
call StopVimInTerminal(buf)
- call delete('Xcuc_insert_on_tab')
endfunc
func Test_cursorcolumn_callback()
@@ -637,14 +634,13 @@
call timer_start(300, 'Func')
END
- call writefile(lines, 'Xcuc_timer')
+ call writefile(lines, 'Xcuc_timer', 'D')
let buf = RunVimInTerminal('-S Xcuc_timer', #{rows: 8})
call TermWait(buf, 310)
call VerifyScreenDump(buf, 'Test_cursorcolumn_callback_1', {})
call StopVimInTerminal(buf)
- call delete('Xcuc_timer')
endfunc
func Test_wincolor()
@@ -663,7 +659,7 @@
call prop_add(6, 12, {"type": "foo", "end_col": 15})
/here
END
- call writefile(lines, 'Xtest_wincolor')
+ call writefile(lines, 'Xtest_wincolor', 'D')
let buf = RunVimInTerminal('-S Xtest_wincolor', {'rows': 8})
call TermWait(buf)
call term_sendkeys(buf, "2G5lvj")
@@ -674,7 +670,6 @@
" clean up
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
- call delete('Xtest_wincolor')
endfunc
func Test_wincolor_listchars()
@@ -689,7 +684,7 @@
call matchadd('Conceal', 'text')
normal 2G5zl
END
- call writefile(lines, 'Xtest_wincolorlcs')
+ call writefile(lines, 'Xtest_wincolorlcs', 'D')
let buf = RunVimInTerminal('-S Xtest_wincolorlcs', {'rows': 8})
call VerifyScreenDump(buf, 'Test_wincolor_lcs', {})
@@ -697,7 +692,6 @@
" clean up
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
- call delete('Xtest_wincolorlcs')
endfunc
func Test_colorcolumn()
@@ -714,14 +708,13 @@
wincmd w
buf X
END
- call writefile(lines, 'Xtest_colorcolumn')
+ call writefile(lines, 'Xtest_colorcolumn', 'D')
let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10})
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_colorcolumn_1', {})
" clean up
call StopVimInTerminal(buf)
- call delete('Xtest_colorcolumn')
endfunc
func Test_colorcolumn_bri()
@@ -731,14 +724,13 @@
let lines =<< trim END
call setline(1, 'The quick brown fox jumped over the lazy dogs')
END
- call writefile(lines, 'Xtest_colorcolumn_bri')
+ call writefile(lines, 'Xtest_colorcolumn_bri', 'D')
let buf = RunVimInTerminal('-S Xtest_colorcolumn_bri', {'rows': 10,'columns': 40})
call term_sendkeys(buf, ":set co=40 linebreak bri briopt=shift:2 cc=40,41,43\<CR>")
call VerifyScreenDump(buf, 'Test_colorcolumn_2', {})
" clean up
call StopVimInTerminal(buf)
- call delete('Xtest_colorcolumn_bri')
endfunc
func Test_colorcolumn_sbr()
@@ -748,14 +740,13 @@
let lines =<< trim END
call setline(1, 'The quick brown fox jumped over the lazy dogs')
END
- call writefile(lines, 'Xtest_colorcolumn_srb')
+ call writefile(lines, 'Xtest_colorcolumn_srb', 'D')
let buf = RunVimInTerminal('-S Xtest_colorcolumn_srb', {'rows': 10,'columns': 40})
call term_sendkeys(buf, ":set co=40 showbreak=+++>\\ cc=40,41,43\<CR>")
call VerifyScreenDump(buf, 'Test_colorcolumn_3', {})
" clean up
call StopVimInTerminal(buf)
- call delete('Xtest_colorcolumn_srb')
endfunc
" This test must come before the Test_cursorline test, as it appears this