1
0
forked from aniani/vim

patch 8.2.4296: Vim9: not all code covered by tests

Problem:    Vim9: not all code covered by tests.
Solution:   Add a few more tests for corner cases.  Fix hang when single quote
            is missing.
This commit is contained in:
Bram Moolenaar 2022-02-04 21:17:58 +00:00
parent 3e79c97c18
commit 83d0cec956
5 changed files with 13 additions and 2 deletions

View File

@ -1993,6 +1993,12 @@ def Test_unlet()
assert_false(exists('s:somevar'))
unlet! s:somevar
if 0
unlet g:does_not_exist
endif
v9.CheckDefExecFailure(['unlet v:notfound.key'], 'E1001:')
v9.CheckDefExecFailure([
'var dd = 111',
'unlet dd',

View File

@ -1449,7 +1449,7 @@ def Test_lockvar()
ex = v:exception
endtry
assert_match('E1121:', ex)
unlockvar d.a
unlockvar d['a']
d.a = 7
assert_equal({a: 7, b: 5}, d)

View File

@ -1833,6 +1833,7 @@ def Test_expr8_string()
v9.CheckDefAndScriptFailure(['var x = "abc'], 'E114:', 1)
v9.CheckDefAndScriptFailure(["var x = 'abc"], 'E115:', 1)
v9.CheckDefFailure(["if 0", "echo 'xx", "endif"], 'E115', 2)
enddef
def Test_expr8_vimvar()

View File

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

View File

@ -2824,8 +2824,10 @@ compile_expr1(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
// Ignore all kinds of errors when not producing code.
if (cctx->ctx_skip == SKIP_YES)
{
int prev_did_emsg = did_emsg;
skip_expr_cctx(arg, cctx);
return OK;
return did_emsg == prev_did_emsg ? OK : FAIL;
}
// Evaluate the first expression.