From f196ab87a1b5a9da1326d4de883ab7e97a0bb1f0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 20:05:52 -0500 Subject: vim-patch:8.1.2348: :const cannot be followed by "| endif" Problem: :const cannot be followed by "| endif". Solution: Check following command for :const. (closes vim/vim#5269) Also fix completion after :const. https://github.com/vim/vim/commit/8f76e6b12b958f2779444a92234bbaf3f49eeb99 --- src/nvim/testdir/test_const.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir/test_const.vim') diff --git a/src/nvim/testdir/test_const.vim b/src/nvim/testdir/test_const.vim index 06062c5e58..1d7b0a56b5 100644 --- a/src/nvim/testdir/test_const.vim +++ b/src/nvim/testdir/test_const.vim @@ -176,6 +176,12 @@ func Test_cannot_modify_existing_variable() call assert_fails('const [i2, f2, s2] = [1, 1.1, "vim"]', 'E995:') endfunc +func Test_const_with_condition() + const x = 0 + if 0 | const x = 1 | endif + call assert_equal(0, x) +endfunc + func Test_const_with_index_access() let l = [1, 2, 3] call assert_fails('const l[0] = 4', 'E996:') -- cgit From 90f2b1360469821dfd0e7e75d0b43859aa27dac1 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 20:40:12 -0500 Subject: 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 vim/vim#5269) https://github.com/vim/vim/commit/cc4423ae13d78367a3d0b5756783523d3b3a1d31 --- src/nvim/testdir/test_const.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/nvim/testdir/test_const.vim') diff --git a/src/nvim/testdir/test_const.vim b/src/nvim/testdir/test_const.vim index 1d7b0a56b5..eaf200e9bb 100644 --- a/src/nvim/testdir/test_const.vim +++ b/src/nvim/testdir/test_const.vim @@ -182,6 +182,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:') -- cgit