comparison src/testdir/test_vim9_cmd.vim @ 24262:d0e86f1b34e7 v8.2.2672

patch 8.2.2672: Vim9: cannot use :lockvar and :unlockvar in compiled script Commit: https://github.com/vim/vim/commit/b2cb6c8bbd215177ed05c1d952e7ef2ad8f7ef4b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 28 20:38:34 2021 +0200 patch 8.2.2672: Vim9: cannot use :lockvar and :unlockvar in compiled script Problem: Vim9: cannot use :lockvar and :unlockvar in compiled script. Solution: Implement locking support.
author Bram Moolenaar <Bram@vim.org>
date Sun, 28 Mar 2021 20:45:06 +0200
parents a2e6029d354e
children f293bb501b30
comparison
equal deleted inserted replaced
24261:f5ada7905e93 24262:d0e86f1b34e7
1133 windo if 1 1133 windo if 1
1134 END 1134 END
1135 CheckDefExecFailure(lines, 'E171:', 1) 1135 CheckDefExecFailure(lines, 'E171:', 1)
1136 enddef 1136 enddef
1137 1137
1138 let s:theList = [1, 2, 3]
1139
1140 def Test_lockvar()
1141 s:theList[1] = 22
1142 assert_equal([1, 22, 3], s:theList)
1143 lockvar s:theList
1144 assert_fails('theList[1] = 77', 'E741:')
1145 unlockvar s:theList
1146 s:theList[1] = 44
1147 assert_equal([1, 44, 3], s:theList)
1148
1149 var lines =<< trim END
1150 vim9script
1151 var theList = [1, 2, 3]
1152 def SetList()
1153 theList[1] = 22
1154 assert_equal([1, 22, 3], theList)
1155 lockvar theList
1156 theList[1] = 77
1157 enddef
1158 SetList()
1159 END
1160 CheckScriptFailure(lines, 'E1119', 4)
1161
1162 lines =<< trim END
1163 var theList = [1, 2, 3]
1164 lockvar theList
1165 END
1166 CheckDefFailure(lines, 'E1178', 2)
1167
1168 lines =<< trim END
1169 var theList = [1, 2, 3]
1170 unlockvar theList
1171 END
1172 CheckDefFailure(lines, 'E1178', 2)
1173 enddef
1174
1175
1138 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker 1176 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker