diff src/testdir/test_const.vim @ 22298:07e48ee8c3bb v8.2.1698

patch 8.2.1698: cannot lock a variable in legacy Vim script like in Vim9 Commit: https://github.com/vim/vim/commit/a187c43cfe8863d48b2159d695fedcb71f8525c1 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 16 21:08:28 2020 +0200 patch 8.2.1698: cannot lock a variable in legacy Vim script like in Vim9 Problem: Cannot lock a variable in legacy Vim script like in Vim9. Solution: Make ":lockvar 0" work.
author Bram Moolenaar <Bram@vim.org>
date Wed, 16 Sep 2020 21:15:05 +0200
parents ff21e2962490
children 04205b7d67d5
line wrap: on
line diff
--- a/src/testdir/test_const.vim
+++ b/src/testdir/test_const.vim
@@ -215,6 +215,14 @@ func Test_lockvar()
 
   if 0 | lockvar x | endif
   let x = 'again'
+
+  let val = [1, 2, 3]
+  lockvar 0 val
+  let val[0] = 9
+  call assert_equal([9, 2, 3], val)
+  call add(val, 4)
+  call assert_equal([9, 2, 3, 4], val)
+  call assert_fails('let val = [4, 5, 6]', 'E1122:')
 endfunc