Mercurial > vim
comparison src/testdir/test_const.vim @ 18715:bd4c34db84ab v8.1.2349
patch 8.1.2349: :lockvar and :unlockvar cannot be followed by "| endif"
Commit: https://github.com/vim/vim/commit/cc4423ae13d78367a3d0b5756783523d3b3a1d31
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 26 17:05:00 2019 +0100
patch 8.1.2349: :lockvar and :unlockvar cannot be followed by "| endif"
Problem: :lockvar and :unlockvar cannot be followed by "| endif".
Solution: Check for following commands. (closes https://github.com/vim/vim/issues/5269)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 26 Nov 2019 17:15:03 +0100 |
parents | baf890fa1621 |
children | da98d2ed8dc5 |
comparison
equal
deleted
inserted
replaced
18714:85d425beb6c1 | 18715:bd4c34db84ab |
---|---|
201 const x = 0 | 201 const x = 0 |
202 if 0 | const x = 1 | endif | 202 if 0 | const x = 1 | endif |
203 call assert_equal(0, x) | 203 call assert_equal(0, x) |
204 endfunc | 204 endfunc |
205 | 205 |
206 func Test_lockvar() | |
207 let x = 'hello' | |
208 lockvar x | |
209 call assert_fails('let x = "there"', 'E741') | |
210 if 0 | unlockvar x | endif | |
211 call assert_fails('let x = "there"', 'E741') | |
212 unlockvar x | |
213 let x = 'there' | |
214 | |
215 if 0 | lockvar x | endif | |
216 let x = 'again' | |
217 endfunc | |
218 | |
219 | |
206 func Test_const_with_index_access() | 220 func Test_const_with_index_access() |
207 let l = [1, 2, 3] | 221 let l = [1, 2, 3] |
208 call assert_fails('const l[0] = 4', 'E996:') | 222 call assert_fails('const l[0] = 4', 'E996:') |
209 call assert_fails('const l[0:1] = [1, 2]', 'E996:') | 223 call assert_fails('const l[0:1] = [1, 2]', 'E996:') |
210 | 224 |