summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_listdict.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-19 15:17:21 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-19 15:17:21 +0000
commitf47c5a8e2d8eda7c2c8a9cccf9568eb56c03a0cf (patch)
treed494b8e64cfee58471197e389c0b731f4309cb14 /src/testdir/test_listdict.vim
parent265f811f5a2dac81d9698f5202a661a04ed095f1 (diff)
patch 8.2.3852: Vim9: not enough testsv8.2.3852
Problem: Vim9: not enough tests. Solution: Also run existing tests for Vim9 script. Make errors more consistent.
Diffstat (limited to 'src/testdir/test_listdict.vim')
-rw-r--r--src/testdir/test_listdict.vim13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index de63c79998..ad36cb0bdf 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -1291,12 +1291,19 @@ endfunc
" List and dict indexing tests
func Test_listdict_index()
- call assert_fails('echo function("min")[0]', 'E695:')
- call assert_fails('echo v:true[0]', 'E909:')
+ call CheckLegacyAndVim9Failure(['echo function("min")[0]'], 'E695:')
+ call CheckLegacyAndVim9Failure(['echo v:true[0]'], 'E909:')
+ call CheckLegacyAndVim9Failure(['echo v:null[0]'], 'E909:')
+
let d = {'k' : 10}
call assert_fails('echo d.', 'E15:')
- call assert_fails('echo d[1:2]', 'E719:')
+ call CheckDefAndScriptFailure2(['var d = {k: 10}', 'echo d.'], 'E1127', 'E15:')
+
+ call CheckLegacyAndVim9Failure(['VAR d = {"k": 10}', 'echo d[1 : 2]'], 'E719:')
+
call assert_fails("let v = [4, 6][{-> 1}]", 'E729:')
+ call CheckDefAndScriptFailure2(['var v = [4, 6][() => 1]'], 'E1012', 'E703:')
+
call assert_fails("let v = range(5)[2:[]]", 'E730:')
call assert_fails("let v = range(5)[2:{-> 2}(]", ['E15:', 'E116:'])
call assert_fails("let v = range(5)[2:3", 'E111:')