comparison src/testdir/test_listdict.vim @ 17387:2558f90045e5 v8.1.1692

patch 8.1.1692: using *{} for literal dict is not backwards compatible commit https://github.com/vim/vim/commit/b8be54dcc517c9d57b62409945b7d4b90b6c3071 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 14 18:22:59 2019 +0200 patch 8.1.1692: using *{} for literal dict is not backwards compatible Problem: Using *{} for literal dict is not backwards compatible. (Yasuhiro Matsumoto) Solution: Use ~{} instead.
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Jul 2019 18:30:04 +0200
parents 6f36caf4f702
children 40417757dffd
comparison
equal deleted inserted replaced
17386:b46cfa993bcf 17387:2558f90045e5
279 let expected = 'a:' . string(get(d, 'func')) 279 let expected = 'a:' . string(get(d, 'func'))
280 call assert_equal(expected, d.func(string(remove(d, 'func')))) 280 call assert_equal(expected, d.func(string(remove(d, 'func'))))
281 endfunc 281 endfunc
282 282
283 func Test_dict_literal_keys() 283 func Test_dict_literal_keys()
284 call assert_equal({'one': 1, 'two2': 2, '3three': 3, '44': 4}, *{one: 1, two2: 2, 3three: 3, 44: 4},) 284 call assert_equal({'one': 1, 'two2': 2, '3three': 3, '44': 4}, ~{one: 1, two2: 2, 3three: 3, 44: 4},)
285 call assert_equal('2 3', trim(execute('echo 2 *{blue: 3}.blue'))) 285
286 " why *{} cannot be used
287 let blue = 'blue'
288 call assert_equal('6', trim(execute('echo 2 *{blue: 3}.blue')))
286 endfunc 289 endfunc
287 290
288 " Nasty: deepcopy() dict that refers to itself (fails when noref used) 291 " Nasty: deepcopy() dict that refers to itself (fails when noref used)
289 func Test_dict_deepcopy() 292 func Test_dict_deepcopy()
290 let d = {1:1, 2:2} 293 let d = {1:1, 2:2}