From 30cfdd0ea1f67afed6732ecbcdda9dda72a2b0a0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 5 Nov 2022 14:26:28 +0800 Subject: vim-patch:8.2.5027: error for missing :endif when an exception was thrown Problem: Error for missing :endif when an exception was thrown. (Dani Dickstein) Solution: Do not give an error when aborting. (closes vim/vim#10490) https://github.com/vim/vim/commit/bf79a4e48d09a5ae08645592885d54230fed30b8 Co-authored-by: Bram Moolenaar --- src/nvim/testdir/test_trycatch.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_trycatch.vim b/src/nvim/testdir/test_trycatch.vim index 3dff8fa2d8..8a1d2d3fa7 100644 --- a/src/nvim/testdir/test_trycatch.vim +++ b/src/nvim/testdir/test_trycatch.vim @@ -2221,6 +2221,23 @@ func Test_user_command_throw_in_function_call() unlet g:caught endfunc +" Test that after reporting an uncaught exception there is no error for a +" missing :endif +func Test_after_exception_no_endif_error() + function Throw() + throw "Failure" + endfunction + + function Foo() + if 1 + call Throw() + endif + endfunction + call assert_fails('call Foo()', ['E605:', 'E605:']) + delfunc Throw + delfunc Foo +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 -- cgit