@@ -83,7 +83,7 @@ endfunc
8383
8484" Test for the :drop command
8585func Test_drop_cmd ()
86- call writefile ([' L1' , ' L2' ], ' Xdropfile' )
86+ call writefile ([' L1' , ' L2' ], ' Xdropfile' , ' D ' )
8787 enew | only
8888 drop Xdropfile
8989 call assert_equal (' L2' , getline (2 ))
@@ -99,7 +99,6 @@ func Test_drop_cmd()
9999 " Check for setting the argument list
100100 call assert_equal ([' Xdropfile' ], argv ())
101101 enew | only !
102- call delete (' Xdropfile' )
103102endfunc
104103
105104" Test for the :append command
@@ -141,14 +140,13 @@ func Test_append_cmd_empty_buf()
141140 endfunc
142141 call timer_start (10 , ' Timer' )
143142 END
144- call writefile (lines , ' Xtest_append_cmd_empty_buf' )
143+ call writefile (lines , ' Xtest_append_cmd_empty_buf' , ' D ' )
145144 let buf = RunVimInTerminal (' -S Xtest_append_cmd_empty_buf' , {' rows' : 6 })
146145 call WaitForAssert ({- > assert_equal (' bbbbb' , term_getline (buf , 2 ))})
147146 call WaitForAssert ({- > assert_equal (' aaaaa' , term_getline (buf , 1 ))})
148147
149148 " clean up
150149 call StopVimInTerminal (buf )
151- call delete (' Xtest_append_cmd_empty_buf' )
152150endfunc
153151
154152" Test for the :insert command
@@ -190,14 +188,13 @@ func Test_insert_cmd_empty_buf()
190188 endfunc
191189 call timer_start (10 , ' Timer' )
192190 END
193- call writefile (lines , ' Xtest_insert_cmd_empty_buf' )
191+ call writefile (lines , ' Xtest_insert_cmd_empty_buf' , ' D ' )
194192 let buf = RunVimInTerminal (' -S Xtest_insert_cmd_empty_buf' , {' rows' : 6 })
195193 call WaitForAssert ({- > assert_equal (' bbbbb' , term_getline (buf , 2 ))})
196194 call WaitForAssert ({- > assert_equal (' aaaaa' , term_getline (buf , 1 ))})
197195
198196 " clean up
199197 call StopVimInTerminal (buf )
200- call delete (' Xtest_insert_cmd_empty_buf' )
201198endfunc
202199
203200" Test for the :change command
@@ -241,8 +238,8 @@ func Test_confirm_cmd()
241238 CheckNotGui
242239 CheckRunVimInTerminal
243240
244- call writefile ([' foo1' ], ' Xfoo' )
245- call writefile ([' bar1' ], ' Xbar' )
241+ call writefile ([' foo1' ], ' Xfoo' , ' D ' )
242+ call writefile ([' bar1' ], ' Xbar' , ' D ' )
246243
247244 " Test for saving all the modified buffers
248245 let lines = << trim END
@@ -253,7 +250,7 @@ func Test_confirm_cmd()
253250 call setline (1 , ' bar2' )
254251 wincmd b
255252 END
256- call writefile (lines , ' Xscript' )
253+ call writefile (lines , ' Xscript' , ' D ' )
257254 let buf = RunVimInTerminal (' -S Xscript' , {' rows' : 20 })
258255 call term_sendkeys (buf , " :confirm qall\n " )
259256 call WaitForAssert ({- > assert_match (' \[Y\]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: ' , term_getline (buf , 20 ))}, 1000 )
@@ -302,10 +299,6 @@ func Test_confirm_cmd()
302299
303300 call assert_equal ([' foo4' ], readfile (' Xfoo' ))
304301 call assert_equal ([' bar2' ], readfile (' Xbar' ))
305-
306- call delete (' Xscript' )
307- call delete (' Xfoo' )
308- call delete (' Xbar' )
309302endfunc
310303
311304func Test_confirm_cmd_cancel ()
@@ -318,7 +311,7 @@ func Test_confirm_cmd_cancel()
318311 new
319312 call setline (1 , ' abc' )
320313 END
321- call writefile (lines , ' Xscript' )
314+ call writefile (lines , ' Xscript' , ' D ' )
322315 let buf = RunVimInTerminal (' -S Xscript' , {' rows' : 20 })
323316 call term_sendkeys (buf , " :confirm close\n " )
324317 call WaitForAssert ({- > assert_match (' ^\[Y\]es, (N)o, (C)ancel: *$' ,
@@ -332,7 +325,6 @@ func Test_confirm_cmd_cancel()
332325 call WaitForAssert ({- > assert_match (' ^ *0,0-1 All$' ,
333326 \ term_getline (buf , 20 ))}, 1000 )
334327 call StopVimInTerminal (buf )
335- call delete (' Xscript' )
336328endfunc
337329
338330" The ":confirm" prompt was sometimes used with the terminal in cooked mode.
@@ -342,14 +334,14 @@ func Test_confirm_q_wq()
342334 CheckNotGui
343335 CheckRunVimInTerminal
344336
345- call writefile ([' foo' ], ' Xfoo' )
337+ call writefile ([' foo' ], ' Xfoo' , ' D ' )
346338
347339 let lines = << trim END
348340 set hidden nomore
349341 call setline (1 , ' abc' )
350342 edit Xfoo
351343 END
352- call writefile (lines , ' Xscript' )
344+ call writefile (lines , ' Xscript' , ' D ' )
353345 let buf = RunVimInTerminal (' -S Xscript' , {' rows' : 20 })
354346 call term_sendkeys (buf , " :confirm q\n " )
355347 call WaitForAssert ({- > assert_match (' ^\[Y\]es, (N)o, (C)ancel: *$' ,
@@ -365,23 +357,21 @@ func Test_confirm_q_wq()
365357 call term_sendkeys (buf , ' C' )
366358 call WaitForAssert ({- > assert_notmatch (' ^\[Y\]es, (N)o, (C)ancel: C*$' ,
367359 \ term_getline (buf , 20 ))}, 1000 )
368- call StopVimInTerminal (buf )
369360
370- call delete (' Xscript' )
371- call delete (' Xfoo' )
361+ call StopVimInTerminal (buf )
372362endfunc
373363
374364func Test_confirm_write_ro ()
375365 CheckNotGui
376366 CheckRunVimInTerminal
377367
378- call writefile ([' foo' ], ' Xconfirm_write_ro' )
368+ call writefile ([' foo' ], ' Xconfirm_write_ro' , ' D ' )
379369 let lines = << trim END
380370 set nobackup ff = unix cmdheight = 2
381371 edit Xconfirm_write_ro
382372 norm Abar
383373 END
384- call writefile (lines , ' Xscript' )
374+ call writefile (lines , ' Xscript' , ' D ' )
385375 let buf = RunVimInTerminal (' -S Xscript' , {' rows' : 20 })
386376
387377 " Try to write with 'ro' option.
@@ -422,17 +412,15 @@ func Test_confirm_write_ro()
422412 call assert_equal ([' foo' ], readfile (' Xconfirm_write_ro' ))
423413
424414 call StopVimInTerminal (buf )
425- call delete (' Xscript' )
426- call delete (' Xconfirm_write_ro' )
427415endfunc
428416
429417func Test_confirm_write_partial_file ()
430418 CheckNotGui
431419 CheckRunVimInTerminal
432420
433- call writefile ([' a' , ' b' , ' c' , ' d' ], ' Xwrite_partial' )
421+ call writefile ([' a' , ' b' , ' c' , ' d' ], ' Xwrite_partial' , ' D ' )
434422 call writefile ([' set nobackup ff=unix cmdheight=2' ,
435- \ ' edit Xwrite_partial' ], ' Xscript' )
423+ \ ' edit Xwrite_partial' ], ' Xscript' , ' D ' )
436424 let buf = RunVimInTerminal (' -S Xscript' , {' rows' : 20 })
437425
438426 call term_sendkeys (buf , " :confirm 2,3w\n " )
@@ -458,8 +446,6 @@ func Test_confirm_write_partial_file()
458446 call assert_equal ([' b' , ' c' ], readfile (' Xwrite_partial' ))
459447
460448 call StopVimInTerminal (buf )
461- call delete (' Xwrite_partial' )
462- call delete (' Xscript' )
463449endfunc
464450
465451" Test for the :print command
@@ -509,10 +495,9 @@ func Test_redir_cmd_readonly()
509495 CheckNotRoot
510496
511497 " Redirecting to a read-only file
512- call writefile ([], ' Xredirfile' )
498+ call writefile ([], ' Xredirfile' , ' D ' )
513499 call setfperm (' Xredirfile' , ' r--r--r--' )
514500 call assert_fails (' redir! > Xredirfile' , ' E190:' )
515- call delete (' Xredirfile' )
516501endfunc
517502
518503" Test for the :filetype command
@@ -532,7 +517,7 @@ endfunc
532517
533518" Test for the :read command
534519func Test_read_cmd ()
535- call writefile ([' one' ], ' Xcmdfile' )
520+ call writefile ([' one' ], ' Xcmdfile' , ' D ' )
536521 new
537522 call assert_fails (' read' , ' E32:' )
538523 edit Xcmdfile
@@ -546,7 +531,6 @@ func Test_read_cmd()
546531 call feedkeys (" Qr Xcmdfile\<CR> visual\<CR> " , ' xt' )
547532 call assert_equal ([' one' ], getline (1 , ' $' ))
548533 close !
549- call delete (' Xcmdfile' )
550534endfunc
551535
552536" Test for running Ex commands when text is locked.
@@ -727,7 +711,7 @@ endfunc
727711
728712" Test :write after changing name with :file and loading it with :edit
729713func Test_write_after_rename ()
730- call writefile ([' text' ], ' Xafterfile' )
714+ call writefile ([' text' ], ' Xafterfile' , ' D ' )
731715
732716 enew
733717 file Xafterfile
@@ -737,7 +721,6 @@ func Test_write_after_rename()
737721 edit
738722 write
739723
740- call delete (' Xafterfile' )
741724 bwipe!
742725endfunc
743726
0 commit comments