comparison 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
comparison
equal deleted inserted replaced
22620:b5d68d8a5187 22621:576a69fc0066
618 END 618 END
619 CheckScriptSuccess(lines) 619 CheckScriptSuccess(lines)
620 620
621 lines =<< trim END 621 lines =<< trim END
622 vim9script 622 vim9script
623 @r = ''
623 def Func() 624 def Func()
624 throw @r 625 throw @r
625 enddef 626 enddef
626 var result = '' 627 var result = ''
627 try 628 try
2816 echo one 2817 echo one
2817 END 2818 END
2818 CheckScriptFailure(lines, 'E121:', 6) 2819 CheckScriptFailure(lines, 'E121:', 6)
2819 enddef 2820 enddef
2820 2821
2822 def Test_catch_exception_in_callback()
2823 var lines =<< trim END
2824 vim9script
2825 def Callback(...l: any)
2826 try
2827 var x: string
2828 var y: string
2829 # this error should be caught with CHECKLEN
2830 [x, y] = ['']
2831 catch
2832 g:caught = 'yes'
2833 endtry
2834 enddef
2835 popup_menu('popup', #{callback: Callback})
2836 feedkeys("\r", 'xt')
2837 END
2838 CheckScriptSuccess(lines)
2839
2840 unlet g:caught
2841 enddef
2842
2821 " Keep this last, it messes up highlighting. 2843 " Keep this last, it messes up highlighting.
2822 def Test_substitute_cmd() 2844 def Test_substitute_cmd()
2823 new 2845 new
2824 setline(1, 'something') 2846 setline(1, 'something')
2825 :substitute(some(other( 2847 :substitute(some(other(