]> granicus.if.org Git - vim/commitdiff
patch 8.2.4601: Vim9: not enough test coverage for executing :def function v8.2.4601
authorBram Moolenaar <Bram@vim.org>
Sun, 20 Mar 2022 18:51:00 +0000 (18:51 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 20 Mar 2022 18:51:00 +0000 (18:51 +0000)
Problem:    Vim9: not enough test coverage for executing :def function.
Solution:   Add a few more tests.

src/testdir/test_vim9_cmd.vim
src/testdir/test_vim9_func.vim
src/testdir/test_vim9_script.vim
src/version.c

index ca63709eef19f917942cbd097ac11051ff3e4283..b15028adf4836ea1e6652a2075ff87d509c0c327 100644 (file)
@@ -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
index 5b904faf3b6f558566a80f5d776c4d3781f2c3a3..e884f0e3c4ceb5857566936884339bbd94a1ed18 100644 (file)
@@ -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
 
 
index c94f29870832293fecad137e6c82d28960a90589..3e4e9a4ec740b03c26c89896b15b6ea0da2e098d 100644 (file)
@@ -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
index 0a070938cf2015595d9b05eae28018cc9342fc79..285b3914d5012c2c2dc4cea68a3be420ee4c2042 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4601,
 /**/
     4600,
 /**/