changeset 28154:ae975c8d5438 v8.2.4601

patch 8.2.4601: Vim9: not enough test coverage for executing :def function Commit: https://github.com/vim/vim/commit/efd73ae5d2a533670f562b6df5be2ffeb091185d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 20 18:51:00 2022 +0000 patch 8.2.4601: Vim9: not enough test coverage for executing :def function Problem: Vim9: not enough test coverage for executing :def function. Solution: Add a few more tests.
author Bram Moolenaar <Bram@vim.org>
date Sun, 20 Mar 2022 20:00:03 +0100
parents 2474382f4e7a
children 42ba8af8a1dd
files src/testdir/test_vim9_cmd.vim src/testdir/test_vim9_func.vim src/testdir/test_vim9_script.vim src/version.c
diffstat 4 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -1660,6 +1660,8 @@ def Test_substitute_expr()
   v9.CheckDefFailure(['s/from/\="x")/'], 'E488:')
   v9.CheckDefFailure(['s/from/\="x"/9'], 'E488:')
 
+  v9.CheckDefExecFailure(['s/this/\="that"/'], 'E486:')
+
   # When calling a function the right instruction list needs to be restored.
   g:cond = true
   var lines =<< trim END
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -4085,6 +4085,19 @@ if has('lua')
     EOF
     assert_equal('val', g:d.key)
   enddef
+
+  def Test_lua_heredoc_fails()
+    var lines = [
+      'vim9script',
+      'def ExeLua()',
+        'lua << trim EOLUA',
+            "x = vim.eval('g:nodict')",
+        'EOLUA',
+      'enddef',
+      'ExeLua()',
+      ]
+    v9.CheckScriptFailure(lines, 'E121: Undefined variable: g:nodict')
+  enddef
 endif
 
 
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -2003,6 +2003,12 @@ def Test_for_loop()
       endfor
       assert_equal(6, total)
 
+      total = 0
+      for b in 0z010203
+        total += b
+      endfor
+      assert_equal(6, total)
+
       var chars = ''
       for s: string in 'foobar'
         chars ..= s
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4601,
+/**/
     4600,
 /**/
     4599,