changeset 27539:ce4c2f4ce1f9 v8.2.4296

patch 8.2.4296: Vim9: not all code covered by tests Commit: https://github.com/vim/vim/commit/83d0cec95697c244c8096c78aa806469302a8e19 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 4 21:17:58 2022 +0000 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.
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Feb 2022 22:30:04 +0100
parents f37561549ec2
children de25fd9bb1a6
files src/testdir/test_vim9_assign.vim src/testdir/test_vim9_cmd.vim src/testdir/test_vim9_expr.vim src/version.c src/vim9expr.c
diffstat 5 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -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',
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -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)
 
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -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()
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4296,
+/**/
     4295,
 /**/
     4294,
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -2824,8 +2824,10 @@ compile_expr1(char_u **arg, cctx_T *cctx
     // 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.