diff options
| author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-10-09 01:34:18 +0100 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-04-13 21:15:24 +0800 |
| commit | 93c72d866b3a41c429dd9d278cda7059ebd4afba (patch) | |
| tree | 1ca7caa4271968da4902dfc4d179fc99f0342d31 /src/nvim/testdir | |
| parent | b6026337f25cc708e932b21a9e4e64a174a1d9da (diff) | |
| download | rneovim-93c72d866b3a41c429dd9d278cda7059ebd4afba.tar.gz rneovim-93c72d866b3a41c429dd9d278cda7059ebd4afba.tar.bz2 rneovim-93c72d866b3a41c429dd9d278cda7059ebd4afba.zip | |
vim-patch:8.2.3448: :endtry after function call that throws not found
Problem: :endtry after function call that throws not found.
Solution: Do check for following :endtry if an exception is being thrown.
(closes vim/vim#8889)
https://github.com/vim/vim/commit/1d34189ecb99fa76363c06e1aa815c1075675a1c
Nvim obsoleted did_throw; check current_exception is not NULL instead.
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_trycatch.vim | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_trycatch.vim b/src/nvim/testdir/test_trycatch.vim index 04423fa988..e7b163c94b 100644 --- a/src/nvim/testdir/test_trycatch.vim +++ b/src/nvim/testdir/test_trycatch.vim @@ -2008,7 +2008,7 @@ func Test_user_command_throw_in_function_call() catch /my_error/ let caught = 'yes' catch - let caught = 'no' + let caught = v:exception endtry call assert_equal('yes', caught) END @@ -2019,6 +2019,32 @@ func Test_user_command_throw_in_function_call() unlet g:caught endfunc +" Test for using throw in a called function with following endtry {{{1 +func Test_user_command_function_call_with_endtry() + let lines =<< trim END + funct s:throw(msg) abort + throw a:msg + endfunc + func s:main() abort + try + try + throw 'err1' + catch + call s:throw('err2') | endtry + catch + let s:caught = 'yes' + endtry + endfunc + + call s:main() + call assert_equal('yes', s:caught) + END + call writefile(lines, 'XtestThrow') + source XtestThrow + + call delete('XtestThrow') +endfunc + " Modeline {{{1 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |