Mercurial > vim
diff src/testdir/test_vim9_script.vim @ 23440:b0587f7ec422 v8.2.2263
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Commit: https://github.com/vim/vim/commit/69f7050cebb0f069d6e39571961b9bbe8531c69a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 1 16:10:46 2021 +0100
patch 8.2.2263: Vim9: compilation error with try-catch in skipped block
Problem: Vim9: compilation error with try-catch in skipped block.
Solution: Do not bail out when generate_instr() returns NULL. (closes https://github.com/vim/vim/issues/7584)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 01 Jan 2021 16:15:04 +0100 |
parents | 5807e3958e38 |
children | b02ac00aacbf |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -361,6 +361,35 @@ def Test_try_catch() endtry assert_equal(99, n) + var done = 'no' + if 0 + try | catch | endtry + else + done = 'yes' + endif + assert_equal('yes', done) + + done = 'no' + if 1 + done = 'yes' + else + try | catch | endtry + done = 'never' + endif + assert_equal('yes', done) + + if 1 + else + try | catch /pat/ | endtry + try | catch /pat/ + endtry + try + catch /pat/ | endtry + try + catch /pat/ + endtry + endif + try # string slice returns a string, not a number n = g:astring[3]