forked from aniani/vim
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 #5269)
This commit is contained in:
@@ -203,6 +203,20 @@ func Test_const_with_condition()
|
||||
call assert_equal(0, x)
|
||||
endfunc
|
||||
|
||||
func Test_lockvar()
|
||||
let x = 'hello'
|
||||
lockvar x
|
||||
call assert_fails('let x = "there"', 'E741')
|
||||
if 0 | unlockvar x | endif
|
||||
call assert_fails('let x = "there"', 'E741')
|
||||
unlockvar x
|
||||
let x = 'there'
|
||||
|
||||
if 0 | lockvar x | endif
|
||||
let x = 'again'
|
||||
endfunc
|
||||
|
||||
|
||||
func Test_const_with_index_access()
|
||||
let l = [1, 2, 3]
|
||||
call assert_fails('const l[0] = 4', 'E996:')
|
||||
|
||||
Reference in New Issue
Block a user