diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-09 21:38:43 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-09 21:38:43 +0200 |
commit | 23b5139234a79567097ca73aba15ea134381b934 (patch) | |
tree | ad3d5b39a11ff9487f566ffc4f2c15d1685c907e | |
parent | 42ae78cfff171fbd7412306083fe200245d7a7a6 (diff) | |
download | vim-git-8.1.1311.tar.gz |
patch 8.1.1311: aborting an autocmd with an exception is not testedv8.1.1311
Problem: Aborting an autocmd with an exception is not tested.
Solution: Add a test. Also shows how to abort a command by throwing an
exception.
-rw-r--r-- | src/testdir/test_autocmd.vim | 19 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 55d725e48..48db3e2a9 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -1733,3 +1733,22 @@ func Test_ReadWrite_Autocmds() call delete('Xtest.c') call delete('test.out') endfunc + +func Test_throw_in_BufWritePre() + new + call setline(1, ['one', 'two', 'three']) + call assert_false(filereadable('Xthefile')) + augroup throwing + au BufWritePre X* throw 'do not write' + augroup END + try + w Xthefile + catch + let caught = 1 + endtry + call assert_equal(1, caught) + call assert_false(filereadable('Xthefile')) + + bwipe! + au! throwing +endfunc diff --git a/src/version.c b/src/version.c index 57aff32d6..a9b376e23 100644 --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1311, +/**/ 1310, /**/ 1309, |