comparison src/testdir/test_trycatch.vim @ 25761:e855eba4ac39 v8.2.3416

patch 8.2.3416: second error is reported while exception is being thrown Commit: https://github.com/vim/vim/commit/36f691f5f1d0676f080cc97d697d742ed5cc8251 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 8 15:33:30 2021 +0200 patch 8.2.3416: second error is reported while exception is being thrown Problem: Second error is reported while exception is being thrown. Solution: Do not check for trailing characters when already aborting. (closes #8842)
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 Sep 2021 15:45:03 +0200
parents 3e7723bab4e5
children 5040fae521f6
comparison
equal deleted inserted replaced
25760:3b7afe6d4dfc 25761:e855eba4ac39
2222 2222
2223 call delete('XtestTryCatch') 2223 call delete('XtestTryCatch')
2224 unlet g:caught 2224 unlet g:caught
2225 endfunc 2225 endfunc
2226 2226
2227 " Test for using throw in a called function with following error {{{1
2228 func Test_user_command_throw_in_function_call()
2229 let lines =<< trim END
2230 function s:get_dict() abort
2231 throw 'my_error'
2232 endfunction
2233
2234 try
2235 call s:get_dict().foo()
2236 catch /my_error/
2237 let caught = 'yes'
2238 catch
2239 let caught = 'no'
2240 endtry
2241 call assert_equal('yes', caught)
2242 END
2243 call writefile(lines, 'XtestThrow')
2244 source XtestThrow
2245
2246 call delete('XtestThrow')
2247 unlet g:caught
2248 endfunc
2249
2250
2227 " Modeline {{{1 2251 " Modeline {{{1
2228 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker 2252 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker