0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 9.0.0525: manually deleting temp test files

Problem:    Manually deleting temp test files.
Solution:   Add the 'D' flag to writefile().
This commit is contained in:
Bram Moolenaar
2022-09-20 22:01:33 +01:00
parent 4cbdcbda2d
commit 5917341f65
5 changed files with 59 additions and 102 deletions

View File

@@ -874,7 +874,7 @@ func Test_diff_screen()
set diffexpr=
endfunc
END
call writefile(lines, 'XdiffSetup')
call writefile(lines, 'XdiffSetup', 'D')
" clean up already existing swap files, just in case
call delete('.Xdifile1.swp')
@@ -1002,7 +1002,6 @@ func Test_diff_screen()
call StopVimInTerminal(buf)
call delete('Xdifile1')
call delete('Xdifile2')
call delete('XdiffSetup')
endfunc
func Test_diff_with_scroll_and_change()
@@ -1016,7 +1015,7 @@ func Test_diff_with_scroll_and_change()
wincmd h
exe "normal Gl5\<C-E>"
END
call writefile(lines, 'Xtest_scroll_change')
call writefile(lines, 'Xtest_scroll_change', 'D')
let buf = RunVimInTerminal('-S Xtest_scroll_change', {})
call VerifyScreenDump(buf, 'Test_diff_scroll_change_01', {})
@@ -1029,7 +1028,6 @@ func Test_diff_with_scroll_and_change()
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_scroll_change')
endfunc
func Test_diff_with_cursorline()
@@ -1043,7 +1041,7 @@ func Test_diff_with_cursorline()
\ 'call setline(1, ["bee","foo","foo","baz"])',
\ 'windo diffthis',
\ '2wincmd w',
\ ], 'Xtest_diff_cursorline')
\ ], 'Xtest_diff_cursorline', 'D')
let buf = RunVimInTerminal('-S Xtest_diff_cursorline', {})
call VerifyScreenDump(buf, 'Test_diff_with_cursorline_01', {})
@@ -1054,7 +1052,6 @@ func Test_diff_with_cursorline()
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_cursorline')
endfunc
func Test_diff_with_cursorline_number()
@@ -1071,7 +1068,7 @@ func Test_diff_with_cursorline_number()
windo diffthis
1wincmd w
END
call writefile(lines, 'Xtest_diff_cursorline_number')
call writefile(lines, 'Xtest_diff_cursorline_number', 'D')
let buf = RunVimInTerminal('-S Xtest_diff_cursorline_number', {})
call VerifyScreenDump(buf, 'Test_diff_with_cursorline_number_01', {})
@@ -1080,7 +1077,6 @@ func Test_diff_with_cursorline_number()
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_cursorline_number')
endfunc
func Test_diff_with_cursorline_breakindent()
@@ -1097,7 +1093,7 @@ func Test_diff_with_cursorline_breakindent()
\ 'exe "norm 20Abee\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abaz\<Esc>"',
\ 'windo diffthis',
\ '2wincmd w',
\ ], 'Xtest_diff_cursorline_breakindent')
\ ], 'Xtest_diff_cursorline_breakindent', 'D')
let buf = RunVimInTerminal('-S Xtest_diff_cursorline_breakindent', {})
call term_sendkeys(buf, "gg0")
@@ -1111,7 +1107,6 @@ func Test_diff_with_cursorline_breakindent()
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_cursorline_breakindent')
endfunc
func Test_diff_with_syntax()
@@ -1124,7 +1119,7 @@ func Test_diff_with_syntax()
return 5;
}
END
call writefile(lines, 'Xprogram1.c')
call writefile(lines, 'Xprogram1.c', 'D')
let lines =<< trim END
void doSomething() {
int x = 0;
@@ -1132,22 +1127,19 @@ func Test_diff_with_syntax()
return 5;
}
END
call writefile(lines, 'Xprogram2.c')
call writefile(lines, 'Xprogram2.c', 'D')
let lines =<< trim END
edit Xprogram1.c
diffsplit Xprogram2.c
END
call writefile(lines, 'Xtest_diff_syntax')
call writefile(lines, 'Xtest_diff_syntax', 'D')
let buf = RunVimInTerminal('-S Xtest_diff_syntax', {})
call VerifyScreenDump(buf, 'Test_diff_syntax_1', {})
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_syntax')
call delete('Xprogram1.c')
call delete('Xprogram2.c')
endfunc
func Test_diff_of_diff()
@@ -1161,7 +1153,7 @@ func Test_diff_of_diff()
\ 'windo diffthis',
\ '1wincmd w',
\ 'setlocal number',
\ ], 'Xtest_diff_diff')
\ ], 'Xtest_diff_diff', 'D')
let buf = RunVimInTerminal('-S Xtest_diff_diff', {})
call VerifyScreenDump(buf, 'Test_diff_of_diff_01', {})
@@ -1171,7 +1163,6 @@ func Test_diff_of_diff()
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_diff')
endfunc
func CloseoffSetup()
@@ -1253,8 +1244,8 @@ func Test_patchexpr()
endfunc
set patchexpr=TPatch()
call writefile(['input file'], 'Xinput')
call writefile(['diff file'], 'Xdiff')
call writefile(['input file'], 'Xinput', 'D')
call writefile(['diff file'], 'Xdiff', 'D')
%bwipe!
edit Xinput
diffpatch Xdiff
@@ -1271,8 +1262,6 @@ func Test_patchexpr()
set patchexpr=<SID>NewPatchExpr()
call assert_equal(expand('<SID>') .. 'NewPatchExpr()', &patchexpr)
call delete('Xinput')
call delete('Xdiff')
set patchexpr&
delfunc TPatch
delfunc s:NewPatchExpr
@@ -1289,7 +1278,7 @@ func Test_diff_rnu()
windo diffthis
setlocal number rnu foldcolumn=0
END
call writefile(content, 'Xtest_diff_rnu')
call writefile(content, 'Xtest_diff_rnu', 'D')
let buf = RunVimInTerminal('-S Xtest_diff_rnu', {})
call VerifyScreenDump(buf, 'Test_diff_rnu_01', {})
@@ -1301,7 +1290,6 @@ func Test_diff_rnu()
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_rnu')
endfunc
func Test_diff_multilineconceal()
@@ -1349,7 +1337,7 @@ func Test_diff_filler_cursorcolumn()
norm! gg0
redraw!
END
call writefile(content, 'Xtest_diff_cuc')
call writefile(content, 'Xtest_diff_cuc', 'D')
let buf = RunVimInTerminal('-S Xtest_diff_cuc', {})
call VerifyScreenDump(buf, 'Test_diff_cuc_01', {})
@@ -1366,7 +1354,6 @@ func Test_diff_filler_cursorcolumn()
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_cuc')
endfunc
" Test for adding/removing lines inside diff chunks, between diff chunks
@@ -1465,7 +1452,7 @@ func Test_diff_binary()
norm! gg0
redraw!
END
call writefile(content, 'Xtest_diff_bin')
call writefile(content, 'Xtest_diff_bin', 'D')
let buf = RunVimInTerminal('-S Xtest_diff_bin', {})
" Test using internal diff
@@ -1486,7 +1473,6 @@ func Test_diff_binary()
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_bin')
set diffopt&vim
endfunc
@@ -1556,7 +1542,7 @@ func Test_diff_scroll()
// containing
// four lines
END
call writefile(left, 'Xleft')
call writefile(left, 'Xleft', 'D')
let right =<< trim END
line 1
line 2
@@ -1592,7 +1578,7 @@ func Test_diff_scroll()
// containing
// four lines
END
call writefile(right, 'Xright')
call writefile(right, 'Xright', 'D')
let buf = RunVimInTerminal('-d Xleft Xright', {'rows': 12})
call term_sendkeys(buf, "\<C-W>\<C-W>jjjj")
call VerifyScreenDump(buf, 'Test_diff_scroll_1', {})
@@ -1600,8 +1586,6 @@ func Test_diff_scroll()
call VerifyScreenDump(buf, 'Test_diff_scroll_2', {})
call StopVimInTerminal(buf)
call delete('Xleft')
call delete('Xright')
endfunc
" This was trying to update diffs for a buffer being closed