Mercurial > vim
diff src/testdir/test_vim9_script.vim @ 22621:576a69fc0066 v8.2.1859
patch 8.2.1859: Vim9: crash in unpack assignment
Commit: https://github.com/vim/vim/commit/352134bbfbff4831a3f6a3383d9e2d8660016243
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 17 22:04:08 2020 +0200
patch 8.2.1859: Vim9: crash in unpack assignment
Problem: Vim9: crash in unpack assignment.
Solution: Make sure an error message is turned into an exception.
(closes #7159)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 17 Oct 2020 22:15:03 +0200 |
parents | b08f435d5b86 |
children | 71b57779177d |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -620,6 +620,7 @@ def Test_throw_vimscript() lines =<< trim END vim9script + @r = '' def Func() throw @r enddef @@ -2818,6 +2819,27 @@ def Test_script_var_scope() CheckScriptFailure(lines, 'E121:', 6) enddef +def Test_catch_exception_in_callback() + var lines =<< trim END + vim9script + def Callback(...l: any) + try + var x: string + var y: string + # this error should be caught with CHECKLEN + [x, y] = [''] + catch + g:caught = 'yes' + endtry + enddef + popup_menu('popup', #{callback: Callback}) + feedkeys("\r", 'xt') + END + CheckScriptSuccess(lines) + + unlet g:caught +enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new