diff src/testdir/test_vim9_cmd.vim @ 26240:640b62dbf6cb v8.2.3651

patch 8.2.3651: Vim9: no error for :lock or :unlock with unknown variable Commit: https://github.com/vim/vim/commit/04b568b38f848293e1ae0e680685280151acb386 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 22 21:58:41 2021 +0000 patch 8.2.3651: Vim9: no error for :lock or :unlock with unknown variable Problem: Vim9: no error for :lock or :unlock with unknown variable. Solution: Give an error. (closes https://github.com/vim/vim/issues/9188)
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Nov 2021 23:00:03 +0100
parents 269ecc6d69bc
children 3711e56f7e7b
line wrap: on
line diff
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -1370,6 +1370,23 @@ def Test_lockvar()
       unlockvar theList
   END
   CheckDefFailure(lines, 'E1178', 2)
+
+  lines =<< trim END
+      vim9script
+      var name = 'john'
+      lockvar nameX
+  END
+  CheckScriptFailure(lines, 'E1246', 3)
+
+  lines =<< trim END
+      vim9script
+      var name = 'john'
+      def LockIt()
+        lockvar nameX
+      enddef
+      LockIt()
+  END
+  CheckScriptFailure(lines, 'E1246', 1)
 enddef
 
 def Test_substitute_expr()