mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.0.1267: Test_swap_group may leave file behind
Problem: Test_swap_group may leave file behind. Solution: Add a try/finally.
This commit is contained in:
@@ -56,27 +56,29 @@ func Test_swap_group()
|
|||||||
throw 'Skipped: need at least two groups, got ' . string(groups)
|
throw 'Skipped: need at least two groups, got ' . string(groups)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call delete('Xtest')
|
try
|
||||||
split Xtest
|
call delete('Xtest')
|
||||||
call setline(1, 'just some text')
|
split Xtest
|
||||||
wq
|
call setline(1, 'just some text')
|
||||||
if system('ls -l Xtest') !~ ' ' . groups[0] . ' \d'
|
wq
|
||||||
throw 'Skipped: test file does not have the first group'
|
if system('ls -l Xtest') !~ ' ' . groups[0] . ' \d'
|
||||||
else
|
throw 'Skipped: test file does not have the first group'
|
||||||
silent !chmod 640 Xtest
|
|
||||||
call system('chgrp ' . groups[1] . ' Xtest')
|
|
||||||
if system('ls -l Xtest') !~ ' ' . groups[1] . ' \d'
|
|
||||||
throw 'Skipped: cannot set second group on test file'
|
|
||||||
else
|
else
|
||||||
split Xtest
|
silent !chmod 640 Xtest
|
||||||
let swapname = substitute(execute('swapname'), '[[:space:]]', '', 'g')
|
call system('chgrp ' . groups[1] . ' Xtest')
|
||||||
call assert_match('Xtest', swapname)
|
if system('ls -l Xtest') !~ ' ' . groups[1] . ' \d'
|
||||||
" Group of swapfile must now match original file.
|
throw 'Skipped: cannot set second group on test file'
|
||||||
call assert_match(' ' . groups[1] . ' \d', system('ls -l ' . swapname))
|
else
|
||||||
|
split Xtest
|
||||||
|
let swapname = substitute(execute('swapname'), '[[:space:]]', '', 'g')
|
||||||
|
call assert_match('Xtest', swapname)
|
||||||
|
" Group of swapfile must now match original file.
|
||||||
|
call assert_match(' ' . groups[1] . ' \d', system('ls -l ' . swapname))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
finally
|
||||||
|
call delete('Xtest')
|
||||||
call delete('Xtest')
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -190,6 +190,7 @@ func Test_undojoin_redo()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_undo_write()
|
func Test_undo_write()
|
||||||
|
call delete('Xtest')
|
||||||
split Xtest
|
split Xtest
|
||||||
call feedkeys("ione one one\<Esc>", 'xt')
|
call feedkeys("ione one one\<Esc>", 'xt')
|
||||||
w!
|
w!
|
||||||
|
@@ -761,6 +761,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 */
|
||||||
|
/**/
|
||||||
|
1267,
|
||||||
/**/
|
/**/
|
||||||
1266,
|
1266,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user