0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.3103: swap test may fail on some systems

Problem:    Swap test may fail on some systems when jobs take longer to exit.
Solution:   Use different file names.
This commit is contained in:
Bram Moolenaar
2021-07-04 17:36:54 +02:00
parent 3777d6e32b
commit f33cae6050
2 changed files with 15 additions and 13 deletions

View File

@@ -502,18 +502,18 @@ endfunc
" Test for renaming a buffer when the swap file is deleted out-of-band " Test for renaming a buffer when the swap file is deleted out-of-band
func Test_missing_swap_file() func Test_missing_swap_file()
CheckUnix CheckUnix
new Xfile1 new Xfile2
call delete(swapname('')) call delete(swapname(''))
call assert_fails('file Xfile2', 'E301:') call assert_fails('file Xfile3', 'E301:')
call assert_equal('Xfile2', bufname()) call assert_equal('Xfile3', bufname())
call assert_true(bufexists('Xfile1'))
call assert_true(bufexists('Xfile2')) call assert_true(bufexists('Xfile2'))
call assert_true(bufexists('Xfile3'))
%bw! %bw!
endfunc endfunc
" Test for :preserve command " Test for :preserve command
func Test_preserve() func Test_preserve()
new Xfile1 new Xfile4
setlocal noswapfile setlocal noswapfile
call assert_fails('preserve', 'E313:') call assert_fails('preserve', 'E313:')
bw! bw!
@@ -521,8 +521,8 @@ endfunc
" Test for the v:swapchoice variable " Test for the v:swapchoice variable
func Test_swapchoice() func Test_swapchoice()
call writefile(['aaa', 'bbb'], 'Xfile1') call writefile(['aaa', 'bbb'], 'Xfile5')
edit Xfile1 edit Xfile5
preserve preserve
let swapfname = swapname('') let swapfname = swapname('')
let b = readblob(swapfname) let b = readblob(swapfname)
@@ -536,7 +536,7 @@ func Test_swapchoice()
autocmd! autocmd!
autocmd SwapExists * let v:swapchoice = 'o' autocmd SwapExists * let v:swapchoice = 'o'
augroup END augroup END
edit Xfile1 edit Xfile5
call assert_true(&readonly) call assert_true(&readonly)
call assert_equal(['aaa', 'bbb'], getline(1, '$')) call assert_equal(['aaa', 'bbb'], getline(1, '$'))
%bw! %bw!
@@ -548,11 +548,11 @@ func Test_swapchoice()
autocmd SwapExists * let v:swapchoice = 'a' autocmd SwapExists * let v:swapchoice = 'a'
augroup END augroup END
try try
edit Xfile1 edit Xfile5
catch /^Vim:Interrupt$/ catch /^Vim:Interrupt$/
endtry endtry
call assert_equal('', @%) call assert_equal('', @%)
call assert_true(bufexists('Xfile1')) call assert_true(bufexists('Xfile5'))
%bw! %bw!
call assert_true(filereadable(swapfname)) call assert_true(filereadable(swapfname))
@@ -561,12 +561,12 @@ func Test_swapchoice()
autocmd! autocmd!
autocmd SwapExists * let v:swapchoice = 'd' autocmd SwapExists * let v:swapchoice = 'd'
augroup END augroup END
edit Xfile1 edit Xfile5
call assert_equal('Xfile1', @%) call assert_equal('Xfile5', @%)
%bw! %bw!
call assert_false(filereadable(swapfname)) call assert_false(filereadable(swapfname))
call delete('Xfile1') call delete('Xfile5')
call delete(swapfname) call delete(swapfname)
augroup test_swapchoice augroup test_swapchoice
autocmd! autocmd!

View File

@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3103,
/**/ /**/
3102, 3102,
/**/ /**/