Patch 8.1.1311

10 views
Skip to first unread message

Bram Moolenaar

unread,
May 9, 2019, 3:39:37 PM5/9/19
to vim...@googlegroups.com

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 -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages