diff src/testdir/test_listdict.vim @ 26648:49c240ea23f4 v8.2.3853

patch 8.2.3853: Vim9: not enough tests Commit: https://github.com/vim/vim/commit/700e6b166298ecfb53fe4bf593085b29ca78d556 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 19 17:27:06 2021 +0000 patch 8.2.3853: Vim9: not enough tests Problem: Vim9: not enough tests. Solution: Run more existing tests for Vim9 script.
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Dec 2021 18:30:03 +0100
parents 6f8d3470fa90
children a07323eb647f
line wrap: on
line diff
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -1294,29 +1294,27 @@ func Test_listdict_index()
   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 CheckDefAndScriptFailure2(['var d = {k: 10}', 'echo d.'], 'E1127', 'E15:')
-
+  call CheckLegacyAndVim9Failure(['VAR d = {"k": 10}', 'echo d.'], ['E15:', '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 CheckLegacyAndVim9Failure(['VAR v = range(5)[2 : []]'], ['E730:', 'E1012:', 'E730:'])
+
   call assert_fails("let v = range(5)[2:{-> 2}(]", ['E15:', 'E116:'])
-  call assert_fails("let v = range(5)[2:3", 'E111:')
-  call assert_fails("let l = insert([1,2,3], 4, 10)", 'E684:')
-  call assert_fails("let l = insert([1,2,3], 4, -10)", 'E684:')
-  call assert_fails("let l = insert([1,2,3], 4, [])", 'E745:')
-  let l = [1, 2, 3]
-  call assert_fails("let l[i] = 3", 'E121:')
-  call assert_fails("let l[1.1] = 4", 'E805:')
-  call assert_fails("let l[:i] = [4, 5]", 'E121:')
-  call assert_fails("let l[:3.2] = [4, 5]", 'E805:')
-  let t = test_unknown()
-  call assert_fails("echo t[0]", 'E685:')
+  call CheckDefAndScriptFailure(['var v = range(5)[2 : () => 2(]'], 'E15:')
+
+  call CheckLegacyAndVim9Failure(['VAR v = range(5)[2 : 3'], ['E111:', 'E1097:', 'E111:'])
+  call CheckLegacyAndVim9Failure(['VAR l = insert([1, 2, 3], 4, 10)'], 'E684:')
+  call CheckLegacyAndVim9Failure(['VAR l = insert([1, 2, 3], 4, -10)'], 'E684:')
+  call CheckLegacyAndVim9Failure(['VAR l = insert([1, 2, 3], 4, [])'], ['E745:', 'E1013:', 'E1210:'])
+
+  call CheckLegacyAndVim9Failure(['VAR l = [1, 2, 3]', 'LET l[i] = 3'], ['E121:', 'E1001:', 'E121:'])
+  call CheckLegacyAndVim9Failure(['VAR l = [1, 2, 3]', 'LET l[1.1] = 4'], ['E805:', 'E1012:', 'E805:'])
+  call CheckLegacyAndVim9Failure(['VAR l = [1, 2, 3]', 'LET l[: i] = [4, 5]'], ['E121:', 'E1001:', 'E121:'])
+  call CheckLegacyAndVim9Failure(['VAR l = [1, 2, 3]', 'LET l[: 3.2] = [4, 5]'], ['E805:', 'E1012:', 'E805:'])
+  call CheckLegacyAndVim9Failure(['VAR t = test_unknown()', 'echo t[0]'], 'E685:')
 endfunc
 
 " Test for a null list