aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_const.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-11-27 22:06:31 -0800
committerGitHub <noreply@github.com>2019-11-27 22:06:31 -0800
commit86c4a87fe9a6ce7d5f8fb9de76490b1a0fa64538 (patch)
tree312f751db4acd790b0b61f94a1d1a9de732062a7 /src/nvim/testdir/test_const.vim
parent33beeed4d9c2bda79d48a58ec10e8b05e7de5122 (diff)
parent585e3ddfc785abfd0022af4f9c84f13e24c41782 (diff)
downloadrneovim-86c4a87fe9a6ce7d5f8fb9de76490b1a0fa64538.tar.gz
rneovim-86c4a87fe9a6ce7d5f8fb9de76490b1a0fa64538.tar.bz2
rneovim-86c4a87fe9a6ce7d5f8fb9de76490b1a0fa64538.zip
Merge #11467 from janlazo/vim-8.1.2345
vim-patch:8.1.{1252,1253,1254,1268,2345,2348,2349}
Diffstat (limited to 'src/nvim/testdir/test_const.vim')
-rw-r--r--src/nvim/testdir/test_const.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_const.vim b/src/nvim/testdir/test_const.vim
index 06062c5e58..eaf200e9bb 100644
--- a/src/nvim/testdir/test_const.vim
+++ b/src/nvim/testdir/test_const.vim
@@ -176,6 +176,26 @@ 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_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:')