@@ -5,64 +5,60 @@ source check.vim
55" Test for the :bunload command with an offset
66func 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 .+ 3 bunload
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 .+ 3 bunload
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 .-3 bunload
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 .-3 bunload
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!
134127endfunc
135128
@@ -200,13 +193,13 @@ endfunc
200193" Test for quitting the 'swapfile exists' dialog with the split buffer
201194" command.
202195func 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.
327318func 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' )
346335endfunc
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 )
0 commit comments