diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-06 07:44:34 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-05-06 07:47:43 +0800 |
commit | 6b912dec8ef06535b164b0f4eb3d55775eb9f6a8 (patch) | |
tree | e87e2da65fd5ea42a537d806c26dd7b15333b40d /test | |
parent | ad7f9a701cf25f598cb8ee3d05ad0604fa9a9a65 (diff) | |
download | rneovim-6b912dec8ef06535b164b0f4eb3d55775eb9f6a8.tar.gz rneovim-6b912dec8ef06535b164b0f4eb3d55775eb9f6a8.tar.bz2 rneovim-6b912dec8ef06535b164b0f4eb3d55775eb9f6a8.zip |
vim-patch:9.0.1508: catch does not work when lines are joined with a newline
Problem: Catch does not work when lines are joined with a newline.
Solution: Set "nextcmd" appropriately. (closes vim/vim#12348)
https://github.com/vim/vim/commit/f2588b6fc90ba85b333ee8f747e8d1ebbc7e6300
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_trycatch.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/old/testdir/test_trycatch.vim b/test/old/testdir/test_trycatch.vim index a87b753a34..52a687ab4f 100644 --- a/test/old/testdir/test_trycatch.vim +++ b/test/old/testdir/test_trycatch.vim @@ -2220,6 +2220,36 @@ func Test_BufEnter_exception() %bwipe! endfunc +" Test for using try/catch when lines are joined by "|" or "\n" {{{1 +func Test_try_catch_nextcmd() + func Throw() + throw "Failure" + endfunc + + let lines =<< trim END + try + let s:x = Throw() + catch + let g:caught = 1 + endtry + END + + let g:caught = 0 + call execute(lines) + call assert_equal(1, g:caught) + + let g:caught = 0 + call execute(join(lines, '|')) + call assert_equal(1, g:caught) + + let g:caught = 0 + call execute(join(lines, "\n")) + call assert_equal(1, g:caught) + + unlet g:caught + delfunc Throw +endfunc + " Test for using try/catch in a user command with a failing expression {{{1 func Test_user_command_try_catch() let lines =<< trim END |