Skip to content

Commit 3411265

Browse files
committed
patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Problem: Using separate delete() call instead of writefile() 'D' flag. Solution: Use the writefile 'D' flag.
1 parent 86d8725 commit 3411265

6 files changed

Lines changed: 46 additions & 61 deletions

File tree

src/testdir/test_backup.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ endfunc
7878
" Test for using a non-existing directory as a backup directory
7979
func Test_non_existing_backupdir()
8080
set backupdir=./non_existing_dir backupskip=
81-
call writefile(['line1'], 'Xbackupdir')
81+
call writefile(['line1'], 'Xbackupdir', 'D')
8282
new Xbackupdir
8383
call assert_fails('write', 'E510:')
84+
8485
set backupdir&vim backupskip&vim
85-
call delete('Xbackupdir')
8686
endfunc
8787

8888
" vim: shiftwidth=2 sts=2 expandtab

src/testdir/test_balloon.vim

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func Test_balloon_eval_term()
2929
call feedkeys("\<MouseMove>\<Ignore>", "xt")
3030
endfunc
3131
[CODE]
32-
call writefile(s:common_script + xtra_lines, 'XTest_beval')
32+
call writefile(s:common_script + xtra_lines, 'XTest_beval', 'D')
3333

3434
" Check that the balloon shows up after a mouse move
3535
let buf = RunVimInTerminal('-S XTest_beval', {'rows': 10, 'cols': 50})
@@ -45,7 +45,6 @@ func Test_balloon_eval_term()
4545

4646
" clean up
4747
call StopVimInTerminal(buf)
48-
call delete('XTest_beval')
4948
endfunc
5049

5150
func Test_balloon_eval_term_visual()
@@ -54,7 +53,7 @@ func Test_balloon_eval_term_visual()
5453
call writefile(s:common_script + [
5554
\ 'call test_setmouse(3, 6)',
5655
\ 'call feedkeys("3Gevfr\<MouseMove>\<Ignore>", "xt")',
57-
\ ], 'XTest_beval_visual')
56+
\ ], 'XTest_beval_visual', 'D')
5857

5958
" Check that the balloon shows up after a mouse move
6059
let buf = RunVimInTerminal('-S XTest_beval_visual', {'rows': 10, 'cols': 50})
@@ -63,7 +62,6 @@ func Test_balloon_eval_term_visual()
6362

6463
" clean up
6564
call StopVimInTerminal(buf)
66-
call delete('XTest_beval_visual')
6765
endfunc
6866

6967
" vim: shiftwidth=2 sts=2 expandtab

src/testdir/test_breakindent.vim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,13 @@ func Test_cursor_position_with_showbreak()
902902
repeat('x', &columns - leftcol - 1)->setline(1)
903903
'second line'->setline(2)
904904
END
905-
call writefile(lines, 'XscriptShowbreak')
905+
call writefile(lines, 'XscriptShowbreak', 'D')
906906
let buf = RunVimInTerminal('-S XscriptShowbreak', #{rows: 6})
907907

908908
call term_sendkeys(buf, "AX")
909909
call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak', {})
910910

911911
call StopVimInTerminal(buf)
912-
call delete('XscriptShowbreak')
913912
endfunc
914913

915914
func Test_no_spurious_match()

src/testdir/test_buffer.vim

Lines changed: 37 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,60 @@ source check.vim
55
" Test for the :bunload command with an offset
66
func Test_bunload_with_offset()
77
%bwipe!
8-
call writefile(['B1'], 'b1')
9-
call writefile(['B2'], 'b2')
10-
call writefile(['B3'], 'b3')
11-
call writefile(['B4'], 'b4')
8+
call writefile(['B1'], 'Xb1', 'D')
9+
call writefile(['B2'], 'Xb2', 'D')
10+
call writefile(['B3'], 'Xb3', 'D')
11+
call writefile(['B4'], 'Xb4', 'D')
1212

1313
" Load four buffers. Unload the second and third buffers and then
1414
" execute .+3bunload to unload the last buffer.
15-
edit b1
16-
new b2
17-
new b3
18-
new b4
19-
20-
bunload b2
21-
bunload b3
22-
exe bufwinnr('b1') . 'wincmd w'
15+
edit Xb1
16+
new Xb2
17+
new Xb3
18+
new Xb4
19+
20+
bunload Xb2
21+
bunload Xb3
22+
exe bufwinnr('Xb1') . 'wincmd w'
2323
.+3bunload
24-
call assert_equal(0, getbufinfo('b4')[0].loaded)
25-
call assert_equal('b1',
24+
call assert_equal(0, getbufinfo('Xb4')[0].loaded)
25+
call assert_equal('Xb1',
2626
\ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
2727

2828
" Load four buffers. Unload the third and fourth buffers. Execute .+3bunload
2929
" and check whether the second buffer is unloaded.
3030
ball
31-
bunload b3
32-
bunload b4
33-
exe bufwinnr('b1') . 'wincmd w'
31+
bunload Xb3
32+
bunload Xb4
33+
exe bufwinnr('Xb1') . 'wincmd w'
3434
.+3bunload
35-
call assert_equal(0, getbufinfo('b2')[0].loaded)
36-
call assert_equal('b1',
35+
call assert_equal(0, getbufinfo('Xb2')[0].loaded)
36+
call assert_equal('Xb1',
3737
\ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
3838

3939
" Load four buffers. Unload the second and third buffers and from the last
4040
" buffer execute .-3bunload to unload the first buffer.
4141
ball
42-
bunload b2
43-
bunload b3
44-
exe bufwinnr('b4') . 'wincmd w'
42+
bunload Xb2
43+
bunload Xb3
44+
exe bufwinnr('Xb4') . 'wincmd w'
4545
.-3bunload
46-
call assert_equal(0, getbufinfo('b1')[0].loaded)
47-
call assert_equal('b4',
46+
call assert_equal(0, getbufinfo('Xb1')[0].loaded)
47+
call assert_equal('Xb4',
4848
\ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
4949

5050
" Load four buffers. Unload the first and second buffers. Execute .-3bunload
5151
" from the last buffer and check whether the third buffer is unloaded.
5252
ball
53-
bunload b1
54-
bunload b2
55-
exe bufwinnr('b4') . 'wincmd w'
53+
bunload Xb1
54+
bunload Xb2
55+
exe bufwinnr('Xb4') . 'wincmd w'
5656
.-3bunload
57-
call assert_equal(0, getbufinfo('b3')[0].loaded)
58-
call assert_equal('b4',
57+
call assert_equal(0, getbufinfo('Xb3')[0].loaded)
58+
call assert_equal('Xb4',
5959
\ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
6060

6161
%bwipe!
62-
call delete('b1')
63-
call delete('b2')
64-
call delete('b3')
65-
call delete('b4')
6662

6763
call assert_fails('1,4bunload', 'E16:')
6864
call assert_fails(',100bunload', 'E16:')
@@ -76,9 +72,9 @@ func Test_buflist_browse()
7672
%bwipe!
7773
call assert_fails('buffer 1000', 'E86:')
7874

79-
call writefile(['foo1', 'foo2', 'foo3', 'foo4'], 'Xbrowse1')
80-
call writefile(['bar1', 'bar2', 'bar3', 'bar4'], 'Xbrowse2')
81-
call writefile(['baz1', 'baz2', 'baz3', 'baz4'], 'Xbrowse3')
75+
call writefile(['foo1', 'foo2', 'foo3', 'foo4'], 'Xbrowse1', 'D')
76+
call writefile(['bar1', 'bar2', 'bar3', 'bar4'], 'Xbrowse2', 'D')
77+
call writefile(['baz1', 'baz2', 'baz3', 'baz4'], 'Xbrowse3', 'D')
8278
edit Xbrowse1
8379
let b1 = bufnr()
8480
edit Xbrowse2
@@ -127,9 +123,6 @@ func Test_buflist_browse()
127123

128124
call assert_fails('sandbox bnext', 'E48:')
129125

130-
call delete('Xbrowse1')
131-
call delete('Xbrowse2')
132-
call delete('Xbrowse3')
133126
%bwipe!
134127
endfunc
135128

@@ -200,13 +193,13 @@ endfunc
200193
" Test for quitting the 'swapfile exists' dialog with the split buffer
201194
" command.
202195
func Test_buffer_sbuf_cleanup()
203-
call writefile([], 'XsplitCleanup')
196+
call writefile([], 'XsplitCleanup', 'D')
204197
" first open the file in a buffer
205198
new XsplitCleanup
206199
let bnr = bufnr()
207200
close
208201
" create the swap file
209-
call writefile([], '.XsplitCleanup.swp')
202+
call writefile([], '.XsplitCleanup.swp', 'D')
210203
" Remove the catch-all that runtest.vim adds
211204
au! SwapExists
212205
augroup BufTest
@@ -231,8 +224,6 @@ func Test_buffer_sbuf_cleanup()
231224
call assert_equal(0, getbufinfo('XsplitCleanup')[0].loaded)
232225
set shortmess&
233226

234-
call delete('XsplitCleanup')
235-
call delete('.XsplitCleanup.swp')
236227
augroup BufTest
237228
au!
238229
augroup END
@@ -325,8 +316,8 @@ endfunc
325316
" Test for using CTRL-^ to edit the alternative file keeping the cursor
326317
" position with 'nostartofline'. Also test using the 'buf' command.
327318
func Test_buffer_edit_altfile()
328-
call writefile(repeat(['one two'], 50), 'Xaltfile1')
329-
call writefile(repeat(['five six'], 50), 'Xaltfile2')
319+
call writefile(repeat(['one two'], 50), 'Xaltfile1', 'D')
320+
call writefile(repeat(['five six'], 50), 'Xaltfile2', 'D')
330321
set nosol
331322
edit Xaltfile1
332323
call cursor(25, 5)
@@ -341,8 +332,6 @@ func Test_buffer_edit_altfile()
341332
buf Xaltfile2
342333
call assert_equal([0, 30, 4, 0], getpos('.'))
343334
set sol&
344-
call delete('Xaltfile1')
345-
call delete('Xaltfile2')
346335
endfunc
347336

348337
" Test for running the :sball command with a maximum window count and a
@@ -494,7 +483,7 @@ func Test_buflist_alloc_failure()
494483
call assert_fails('%bw!', 'E342:')
495484

496485
" test for :checktime loading the buffer
497-
call writefile(['one'], 'XallocFail5')
486+
call writefile(['one'], 'XallocFail5', 'D')
498487
if has('unix')
499488
edit XallocFail5
500489
" sleep for some time to make sure the timestamp is different
@@ -510,7 +499,6 @@ func Test_buflist_alloc_failure()
510499
" test for :vimgrep loading a dummy buffer
511500
call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
512501
call assert_fails('vimgrep two XallocFail5', 'E342:')
513-
call delete('XallocFail5')
514502

515503
" test for quickfix command loading a buffer
516504
call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)

src/testdir/test_bufline.vim

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ func Test_setline_startup()
8181
if cmd == ''
8282
return
8383
endif
84-
call writefile(['call setline(1, "Hello")', 'silent w Xtest', 'q!'], 'Xscript')
84+
call writefile(['call setline(1, "Hello")', 'silent w Xtest', 'q!'], 'Xscript', 'D')
8585
call system(cmd)
8686
call assert_equal(['Hello'], readfile('Xtest'))
8787

88-
call delete('Xscript')
8988
call delete('Xtest')
9089
endfunc
9190

@@ -214,12 +213,11 @@ func Test_appendbufline_redraw()
214213
call deletebufline(buf, 1, '$')
215214
call appendbufline(buf, '$', 'Hello Vim world...')
216215
END
217-
call writefile(lines, 'XscriptMatchCommon')
216+
call writefile(lines, 'XscriptMatchCommon', 'D')
218217
let buf = RunVimInTerminal('-S XscriptMatchCommon', #{rows: 10})
219218
call VerifyScreenDump(buf, 'Test_appendbufline_1', {})
220219

221220
call StopVimInTerminal(buf)
222-
call delete('XscriptMatchCommon')
223221
endfunc
224222

225223
func Test_setbufline_select_mode()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ static char *(features[]) =
703703

704704
static int included_patches[] =
705705
{ /* Add new patch number below this line */
706+
/**/
707+
391,
706708
/**/
707709
390,
708710
/**/

0 commit comments

Comments
 (0)