Mercurial > vim
diff src/testdir/test_vim9_script.vim @ 20289:208b38bddc36 v8.2.0700
patch 8.2.0700: Vim9: converting error message to exception not tested
Commit: https://github.com/vim/vim/commit/40ee466c361b9698c2a452a36ff4d6c6e5382ed0
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 5 22:08:26 2020 +0200
patch 8.2.0700: Vim9: converting error message to exception not tested
Problem: Vim9: converting error message to exception not tested.
Solution: Test exception from error. Do not continue after :echoerr.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 05 May 2020 22:15:04 +0200 |
parents | 5a397db2c1ed |
children | f7b1e43beb8f |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -466,6 +466,20 @@ def Test_try_catch_fails() call CheckDefFailure(['throw xxx'], 'E1001:') enddef +let someJob = test_null_job() + +def FuncWithError() + echomsg g:someJob +enddef + +func Test_convert_emsg_to_exception() + try + call FuncWithError() + catch + call assert_match('Vim:E908:', v:exception) + endtry +endfunc + let s:export_script_lines =<< trim END vim9script let name: string = 'bob' @@ -1058,7 +1072,11 @@ def Test_echomsg_cmd() enddef def Test_echoerr_cmd() - # TODO: write this test + try + echoerr 'something' 'wrong' # comment + catch + assert_match('something wrong', v:exception) + endtry enddef def Test_for_outside_of_function()