Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
22297:3d2dc70119a7 | 22298:07e48ee8c3bb |
---|---|
213 unlockvar x | 213 unlockvar x |
214 let x = 'there' | 214 let x = 'there' |
215 | 215 |
216 if 0 | lockvar x | endif | 216 if 0 | lockvar x | endif |
217 let x = 'again' | 217 let x = 'again' |
218 | |
219 let val = [1, 2, 3] | |
220 lockvar 0 val | |
221 let val[0] = 9 | |
222 call assert_equal([9, 2, 3], val) | |
223 call add(val, 4) | |
224 call assert_equal([9, 2, 3, 4], val) | |
225 call assert_fails('let val = [4, 5, 6]', 'E1122:') | |
218 endfunc | 226 endfunc |
219 | 227 |
220 | 228 |
221 func Test_const_with_index_access() | 229 func Test_const_with_index_access() |
222 let l = [1, 2, 3] | 230 let l = [1, 2, 3] |