diff 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
line wrap: on
line diff
--- a/src/testdir/test_const.vim
+++ b/src/testdir/test_const.vim
@@ -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:')