vim-patch:9.2.0342: tests: test_excmd.vim leaves swapfiles behind

Problem:  tests: test_excmd.vim leaves swapfiles behind
Solution: Close open buffer using :bw!

related: vim/vim#19975

c922202ea2

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2026-04-15 06:27:40 +08:00
parent 65680f59d1
commit 504aa9253a

View File

@@ -71,7 +71,7 @@ func Test_copy()
exe "normal! gg4:yank\<CR>"
call assert_equal("L1\nL2\nL1\nL2\n", @")
close!
bw!
endfunc
" Test for the :file command
@@ -115,7 +115,7 @@ func Test_drop_cmd()
call assert_equal(1, winnr('$'))
" Check for setting the argument list
call assert_equal(['Xdropfile'], argv())
enew | only!
enew | only! | bw! Xdropfile
endfunc
" Test for the :append command
@@ -143,7 +143,7 @@ func Test_append_cmd()
call assert_equal([' L1', ' L2', ' L3'], getline(1, '$'))
call assert_true(&autoindent)
set autoindent&
close!
bw!
endfunc
func Test_append_cmd_empty_buf()
@@ -192,7 +192,7 @@ func Test_insert_cmd()
call assert_equal([' L2', ' L3', ' L1'], getline(1, '$'))
call assert_true(&autoindent)
set autoindent&
close!
bw!
endfunc
func Test_insert_cmd_empty_buf()
@@ -241,7 +241,7 @@ func Test_change_cmd()
call assert_equal([' L4', ' L5', 'L2', 'L3'], getline(1, '$'))
call assert_true(&autoindent)
set autoindent&
close!
bw!
endfunc
" Test for the :language command
@@ -555,21 +555,20 @@ endfunc
" Test for the :read command
func Test_read_cmd()
call writefile(['one'], 'Xfile')
call writefile(['one'], 'Xcmdfile', 'D')
new
call assert_fails('read', 'E32:')
edit Xfile
edit Xcmdfile
read
call assert_equal(['one', 'one'], getline(1, '$'))
close!
bw!
new
read Xfile
read Xcmdfile
call assert_equal(['', 'one'], getline(1, '$'))
call deletebufline('', 1, '$')
call feedkeys("Qr Xfile\<CR>visual\<CR>", 'xt')
call feedkeys("Qr Xcmdfile\<CR>visual\<CR>", 'xt')
call assert_equal(['one'], getline(1, '$'))
close!
call delete('Xfile')
bw!
endfunc
" Test for running Ex commands when text is locked.
@@ -636,7 +635,7 @@ func Test_excmd_delete()
call assert_equal([' bar'], split(execute('deletp'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal([' bar'], split(execute('deletep'), "\n"))
close!
bw!
endfunc
" Test for commands that are blocked in a sandbox