0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

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.
This commit is contained in:
Bram Moolenaar
2020-05-05 22:08:26 +02:00
parent 015f4267f4
commit 40ee466c36
3 changed files with 21 additions and 7 deletions

View File

@@ -466,6 +466,20 @@ def Test_try_catch_fails()
call CheckDefFailure(['throw xxx'], 'E1001:') call CheckDefFailure(['throw xxx'], 'E1001:')
enddef 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 let s:export_script_lines =<< trim END
vim9script vim9script
let name: string = 'bob' let name: string = 'bob'
@@ -1058,7 +1072,11 @@ def Test_echomsg_cmd()
enddef enddef
def Test_echoerr_cmd() def Test_echoerr_cmd()
# TODO: write this test try
echoerr 'something' 'wrong' # comment
catch
assert_match('something wrong', v:exception)
endtry
enddef enddef
def Test_for_outside_of_function() def Test_for_outside_of_function()

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
700,
/**/ /**/
699, 699,
/**/ /**/

View File

@@ -898,14 +898,8 @@ call_def_function(
} }
else else
{ {
int save_did_emsg = did_emsg;
SOURCING_LNUM = iptr->isn_lnum; SOURCING_LNUM = iptr->isn_lnum;
emsg(ga.ga_data); emsg(ga.ga_data);
if (!force_abort)
// We don't want to abort following
// commands, restore did_emsg.
did_emsg = save_did_emsg;
} }
} }
} }