comparison src/testdir/test_listdict.vim @ 26646:6f8d3470fa90 v8.2.3852

patch 8.2.3852: Vim9: not enough tests Commit: https://github.com/vim/vim/commit/f47c5a8e2d8eda7c2c8a9cccf9568eb56c03a0cf Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 19 15:17:21 2021 +0000 patch 8.2.3852: Vim9: not enough tests Problem: Vim9: not enough tests. Solution: Also run existing tests for Vim9 script. Make errors more consistent.
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Dec 2021 16:30:03 +0100
parents 7c055fdd6200
children 49c240ea23f4
comparison
equal deleted inserted replaced
26645:6a31b4d210e0 26646:6f8d3470fa90
1289 unlet deep_dict 1289 unlet deep_dict
1290 endfunc 1290 endfunc
1291 1291
1292 " List and dict indexing tests 1292 " List and dict indexing tests
1293 func Test_listdict_index() 1293 func Test_listdict_index()
1294 call assert_fails('echo function("min")[0]', 'E695:') 1294 call CheckLegacyAndVim9Failure(['echo function("min")[0]'], 'E695:')
1295 call assert_fails('echo v:true[0]', 'E909:') 1295 call CheckLegacyAndVim9Failure(['echo v:true[0]'], 'E909:')
1296 call CheckLegacyAndVim9Failure(['echo v:null[0]'], 'E909:')
1297
1296 let d = {'k' : 10} 1298 let d = {'k' : 10}
1297 call assert_fails('echo d.', 'E15:') 1299 call assert_fails('echo d.', 'E15:')
1298 call assert_fails('echo d[1:2]', 'E719:') 1300 call CheckDefAndScriptFailure2(['var d = {k: 10}', 'echo d.'], 'E1127', 'E15:')
1301
1302 call CheckLegacyAndVim9Failure(['VAR d = {"k": 10}', 'echo d[1 : 2]'], 'E719:')
1303
1299 call assert_fails("let v = [4, 6][{-> 1}]", 'E729:') 1304 call assert_fails("let v = [4, 6][{-> 1}]", 'E729:')
1305 call CheckDefAndScriptFailure2(['var v = [4, 6][() => 1]'], 'E1012', 'E703:')
1306
1300 call assert_fails("let v = range(5)[2:[]]", 'E730:') 1307 call assert_fails("let v = range(5)[2:[]]", 'E730:')
1301 call assert_fails("let v = range(5)[2:{-> 2}(]", ['E15:', 'E116:']) 1308 call assert_fails("let v = range(5)[2:{-> 2}(]", ['E15:', 'E116:'])
1302 call assert_fails("let v = range(5)[2:3", 'E111:') 1309 call assert_fails("let v = range(5)[2:3", 'E111:')
1303 call assert_fails("let l = insert([1,2,3], 4, 10)", 'E684:') 1310 call assert_fails("let l = insert([1,2,3], 4, 10)", 'E684:')
1304 call assert_fails("let l = insert([1,2,3], 4, -10)", 'E684:') 1311 call assert_fails("let l = insert([1,2,3], 4, -10)", 'E684:')