diff src/testdir/test_expr.vim @ 28002:1012048eed26 v8.2.4526

patch 8.2.4526: Vim9: cannot set variables to a null value Commit: https://github.com/vim/vim/commit/8acb9cc6209768ca7ec75c9f7af8c389312ea8d6 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 8 13:18:55 2022 +0000 patch 8.2.4526: Vim9: cannot set variables to a null value Problem: Vim9: cannot set variables to a null value. Solution: Add null_list, null_job, etc.
author Bram Moolenaar <Bram@vim.org>
date Tue, 08 Mar 2022 14:30:05 +0100
parents dd7d94b911fa
children d10d5cc8e657
line wrap: on
line diff
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -157,12 +157,28 @@ endfunc
 
 func Test_loop_over_null_list()
   let lines =<< trim END
-      VAR null_list = test_null_list()
-      for i in null_list
+      VAR nulllist = test_null_list()
+      for i in nulllist
         call assert_report('should not get here')
       endfor
   END
   call v9.CheckLegacyAndVim9Success(lines)
+
+  let lines =<< trim END
+      var nulllist = null_list
+      for i in nulllist
+        call assert_report('should not get here')
+      endfor
+  END
+  call v9.CheckDefAndScriptSuccess(lines)
+
+  let lines =<< trim END
+      let nulllist = null_list
+      for i in nulllist
+        call assert_report('should not get here')
+      endfor
+  END
+  call v9.CheckScriptFailure(lines, 'E121: Undefined variable: null_list')
 endfunc
 
 func Test_setreg_null_list()