comparison src/testdir/test_listdict.vim @ 21556:963913d80284 v8.2.1328

patch 8.2.1328: no space allowed before comma in list Commit: https://github.com/vim/vim/commit/4d4d1cd5c8b61ef0296bd6190ca2a0b2d6d96ba7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 30 22:14:33 2020 +0200 patch 8.2.1328: no space allowed before comma in list Problem: No space allowed before comma in list. Solution: Legacy Vim script allows it. (closes https://github.com/vim/vim/issues/6577)
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 Jul 2020 22:15:04 +0200
parents 81c47a694479
children ff21e2962490
comparison
equal deleted inserted replaced
21555:9c4e0f006f67 21556:963913d80284
21 call assert_match('E684:', v:exception) 21 call assert_match('E684:', v:exception)
22 endtry 22 endtry
23 call assert_equal(10, x) 23 call assert_equal(10, x)
24 endfunc 24 endfunc
25 25
26 " This was allowed in legacy Vim script
27 let s:list_with_spaces = [1 , 2 , 3]
28
26 " List slices 29 " List slices
27 func Test_list_slice() 30 func Test_list_slice()
28 let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] 31 let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
29 call assert_equal([1, 'as''d', [1, 2, function('strlen')], {'a': 1}], l[:]) 32 call assert_equal([1, 'as''d', [1, 2, function('strlen')], {'a': 1}], l[:])
30 call assert_equal(['as''d', [1, 2, function('strlen')], {'a': 1}], l[1:]) 33 call assert_equal(['as''d', [1, 2, function('strlen')], {'a': 1}], l[1:])
199 " wrong type for key 202 " wrong type for key
200 call assert_fails('let d={[] : 10}', 'E730:') 203 call assert_fails('let d={[] : 10}', 'E730:')
201 " undefined variable as value 204 " undefined variable as value
202 call assert_fails("let d={'k' : i}", 'E121:') 205 call assert_fails("let d={'k' : i}", 'E121:')
203 endfunc 206 endfunc
207
208 " This was allowed in legacy Vim script
209 let s:dict_with_spaces = {'one' : 1 , 'two' : 2 , 'three' : 3}
210 let s:dict_with_spaces_lit = #{one : 1 , two : 2 , three : 3}
204 211
205 " Dictionary identity 212 " Dictionary identity
206 func Test_dict_identity() 213 func Test_dict_identity()
207 let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},} 214 let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},}
208 let dd = d 215 let dd = d