diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-11-04 22:36:53 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-11-04 22:36:53 +0100 |
commit | 5842a748be8039fd6d267f5557fe391c6c95399d (patch) | |
tree | da91f132039cddc987034b22e30e816759fe2581 | |
parent | ffe010fa0363d1a04b15cc6af119a4af63ba9363 (diff) | |
download | vim-git-5842a748be8039fd6d267f5557fe391c6c95399d.tar.gz |
patch 8.0.1267: Test_swap_group may leave file behindv8.0.1267
Problem: Test_swap_group may leave file behind.
Solution: Add a try/finally.
-rw-r--r-- | src/testdir/test_swap.vim | 42 | ||||
-rw-r--r-- | src/testdir/test_undo.vim | 1 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 25 insertions, 20 deletions
diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim index ee11a731b..1c4965ea5 100644 --- a/src/testdir/test_swap.vim +++ b/src/testdir/test_swap.vim @@ -56,27 +56,29 @@ func Test_swap_group() throw 'Skipped: need at least two groups, got ' . string(groups) endif - call delete('Xtest') - split Xtest - call setline(1, 'just some text') - wq - if system('ls -l Xtest') !~ ' ' . groups[0] . ' \d' - throw 'Skipped: test file does not have the first group' - else - 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' + try + call delete('Xtest') + split Xtest + call setline(1, 'just some text') + wq + if system('ls -l Xtest') !~ ' ' . groups[0] . ' \d' + throw 'Skipped: test file does not have the first group' 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)) + 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 + 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 - - call delete('Xtest') + finally + call delete('Xtest') + endtry endfunc diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim index bda7a442f..4ea1c9b69 100644 --- a/src/testdir/test_undo.vim +++ b/src/testdir/test_undo.vim @@ -190,6 +190,7 @@ func Test_undojoin_redo() endfunc func Test_undo_write() + call delete('Xtest') split Xtest call feedkeys("ione one one\<Esc>", 'xt') w! diff --git a/src/version.c b/src/version.c index 81f5fc385..0fb6952d8 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1267, +/**/ 1266, /**/ 1265, |