Mercurial > vim
diff src/testdir/test_trycatch.vim @ 25761:e855eba4ac39 v8.2.3416
patch 8.2.3416: second error is reported while exception is being thrown
Commit: https://github.com/vim/vim/commit/36f691f5f1d0676f080cc97d697d742ed5cc8251
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 8 15:33:30 2021 +0200
patch 8.2.3416: second error is reported while exception is being thrown
Problem: Second error is reported while exception is being thrown.
Solution: Do not check for trailing characters when already aborting.
(closes #8842)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 08 Sep 2021 15:45:03 +0200 |
parents | 3e7723bab4e5 |
children | 5040fae521f6 |
line wrap: on
line diff
--- a/src/testdir/test_trycatch.vim +++ b/src/testdir/test_trycatch.vim @@ -2224,5 +2224,29 @@ func Test_user_command_try_catch() unlet g:caught endfunc +" Test for using throw in a called function with following error {{{1 +func Test_user_command_throw_in_function_call() + let lines =<< trim END + function s:get_dict() abort + throw 'my_error' + endfunction + + try + call s:get_dict().foo() + catch /my_error/ + let caught = 'yes' + catch + let caught = 'no' + endtry + call assert_equal('yes', caught) + END + call writefile(lines, 'XtestThrow') + source XtestThrow + + call delete('XtestThrow') + unlet g:caught +endfunc + + " Modeline {{{1 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker