comparison src/testdir/test_listdict.vim @ 17368:6604ecb7a615 v8.1.1683

patch 8.1.1683: dictionary with string keys is longer than needed commit https://github.com/vim/vim/commit/d5abb4c87727eecb71b0e8ffdda60fc9598272f3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 13 22:46:10 2019 +0200 patch 8.1.1683: dictionary with string keys is longer than needed Problem: Dictionary with string keys is longer than needed. Solution: Use *{key: val} for literaly keys.
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Jul 2019 23:00:05 +0200
parents d8ab4fa99341
children 6f36caf4f702
comparison
equal deleted inserted replaced
17367:d2959e9ddc7c 17368:6604ecb7a615
276 func d.func(a) 276 func d.func(a)
277 return "a:" . a:a 277 return "a:" . a:a
278 endfunc 278 endfunc
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
282
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},)
281 endfunc 285 endfunc
282 286
283 " Nasty: deepcopy() dict that refers to itself (fails when noref used) 287 " Nasty: deepcopy() dict that refers to itself (fails when noref used)
284 func Test_dict_deepcopy() 288 func Test_dict_deepcopy()
285 let d = {1:1, 2:2} 289 let d = {1:1, 2:2}