comparison src/testdir/test_const.vim @ 24685:04205b7d67d5 v8.2.2881

patch 8.2.2881: various pieces of code not covered by tests Commit: https://github.com/vim/vim/commit/611728f80604dd56960e8c197e5749d203c8feb1 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon May 24 15:15:47 2021 +0200 patch 8.2.2881: various pieces of code not covered by tests Problem: Various pieces of code not covered by tests. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/8245)
author Bram Moolenaar <Bram@vim.org>
date Mon, 24 May 2021 15:30:03 +0200
parents 07e48ee8c3bb
children
comparison
equal deleted inserted replaced
24684:1706f44ede8e 24685:04205b7d67d5
221 let val[0] = 9 221 let val[0] = 9
222 call assert_equal([9, 2, 3], val) 222 call assert_equal([9, 2, 3], val)
223 call add(val, 4) 223 call add(val, 4)
224 call assert_equal([9, 2, 3, 4], val) 224 call assert_equal([9, 2, 3, 4], val)
225 call assert_fails('let val = [4, 5, 6]', 'E1122:') 225 call assert_fails('let val = [4, 5, 6]', 'E1122:')
226 endfunc 226
227 227 let l =<< trim END
228 let d = {}
229 lockvar d
230 func d.fn()
231 return 1
232 endfunc
233 END
234 let @a = l->join("\n")
235 call assert_fails('exe @a', 'E741:')
236
237 let l =<< trim END
238 let d = {}
239 let d.fn = function("min")
240 lockvar d.fn
241 func! d.fn()
242 return 1
243 endfunc
244 END
245 let @a = l->join("\n")
246 call assert_fails('exe @a', 'E741:')
247 endfunc
228 248
229 func Test_const_with_index_access() 249 func Test_const_with_index_access()
230 let l = [1, 2, 3] 250 let l = [1, 2, 3]
231 call assert_fails('const l[0] = 4', 'E996:') 251 call assert_fails('const l[0] = 4', 'E996:')
232 call assert_fails('const l[0:1] = [1, 2]', 'E996:') 252 call assert_fails('const l[0:1] = [1, 2]', 'E996:')