comparison src/testdir/test_const.vim @ 18713:baf890fa1621 v8.1.2348

patch 8.1.2348: :const cannot be followed by "| endif" Commit: https://github.com/vim/vim/commit/8f76e6b12b958f2779444a92234bbaf3f49eeb99 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 26 16:50:30 2019 +0100 patch 8.1.2348: :const cannot be followed by "| endif" Problem: :const cannot be followed by "| endif". Solution: Check following command for :const. (closes https://github.com/vim/vim/issues/5269) Also fix completion after :const.
author Bram Moolenaar <Bram@vim.org>
date Tue, 26 Nov 2019 17:00:04 +0100
parents 9606c0adc148
children bd4c34db84ab
comparison
equal deleted inserted replaced
18712:9135f4563b16 18713:baf890fa1621
195 call assert_fails('const n2 = v:null', 'E995:') 195 call assert_fails('const n2 = v:null', 'E995:')
196 call assert_fails('const bl2 = 0zC0FFEE', 'E995:') 196 call assert_fails('const bl2 = 0zC0FFEE', 'E995:')
197 call assert_fails('const [i2, f2, s2] = [1, 1.1, "vim"]', 'E995:') 197 call assert_fails('const [i2, f2, s2] = [1, 1.1, "vim"]', 'E995:')
198 endfunc 198 endfunc
199 199
200 func Test_const_with_condition()
201 const x = 0
202 if 0 | const x = 1 | endif
203 call assert_equal(0, x)
204 endfunc
205
200 func Test_const_with_index_access() 206 func Test_const_with_index_access()
201 let l = [1, 2, 3] 207 let l = [1, 2, 3]
202 call assert_fails('const l[0] = 4', 'E996:') 208 call assert_fails('const l[0] = 4', 'E996:')
203 call assert_fails('const l[0:1] = [1, 2]', 'E996:') 209 call assert_fails('const l[0:1] = [1, 2]', 'E996:')
204 210