diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-16 22:29:52 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-16 22:29:52 +0200 |
commit | 9939f57b7f1c17a0142ebfe4f9e0b634158593e1 (patch) | |
tree | 77a48188a4a88e8bdc7f697ed4f2b06ddf3f6711 /src/testdir/test_vim9_script.vim | |
parent | 916911f598718bc76bc6b87ed703d2805fa49c53 (diff) | |
download | vim-git-9939f57b7f1c17a0142ebfe4f9e0b634158593e1.tar.gz |
patch 8.2.1700: Vim9: try/catch causes wrong value to be returnedv8.2.1700
Problem: Vim9: try/catch causes wrong value to be returned.
Solution: Reset tcd_return. (closes #6964)
Diffstat (limited to 'src/testdir/test_vim9_script.vim')
-rw-r--r-- | src/testdir/test_vim9_script.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index c400e82ac..2f1e708f2 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1169,6 +1169,26 @@ def Test_try_catch_nested() assert_equal('finally', g:in_finally) enddef +def TryOne(): number + try + return 0 + catch + endtry + return 0 +enddef + +def TryTwo(n: number): string + try + let x = {} + catch + endtry + return 'text' +enddef + +def Test_try_catch_twice() + assert_equal('text', TryOne()->TryTwo()) +enddef + def Test_try_catch_match() let seq = 'a' try |