To: vim_dev@googlegroups.com Subject: Patch 8.1.1311 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.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. Files: src/testdir/test_autocmd.vim *** ../vim-8.1.1310/src/testdir/test_autocmd.vim 2019-04-25 22:21:56.931749183 +0200 --- src/testdir/test_autocmd.vim 2019-05-09 21:33:57.024924448 +0200 *************** *** 1733,1735 **** --- 1733,1754 ---- 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 *** ../vim-8.1.1310/src/version.c 2019-05-09 21:08:53.764083394 +0200 --- src/version.c 2019-05-09 21:37:32.256160734 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1311, /**/ -- Corn oil comes from corn and olive oil comes from olives, so where does baby oil come from? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///