]> granicus.if.org Git - vim/commitdiff
patch 8.2.4296: Vim9: not all code covered by tests v8.2.4296
authorBram Moolenaar <Bram@vim.org>
Fri, 4 Feb 2022 21:17:58 +0000 (21:17 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 4 Feb 2022 21:17:58 +0000 (21:17 +0000)
Problem:    Vim9: not all code covered by tests.
Solution:   Add a few more tests for corner cases.  Fix hang when single quote
            is missing.

src/testdir/test_vim9_assign.vim
src/testdir/test_vim9_cmd.vim
src/testdir/test_vim9_expr.vim
src/version.c
src/vim9expr.c

index 744fc5e715594385f816793d3d699127be0af39d..79c08d3f443250c749b3b05d8307cc6a08664454 100644 (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',
index bacf195f103c1a1cedf43111ae916940da72510b..51a62e01f4879b5761a98d4890418dda71cb450e 100644 (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)
 
index cf4347c98c4984e674a6648fc17a6bf3053a8226..87b801446ab06214eb25b4f4efa52c0287cc9c31 100644 (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()
index f11705dbcb68bd2ec58cded1143f149796906b85..503f873df03673b76f4a74eff11fd67a055025e8 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4296,
 /**/
     4295,
 /**/
index d36df84e0b78a6eafbaa606a591b21f1d25ed8f3..146e136bda796fc4002145b836ee61b764439cf5 100644 (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.