From d83a196716e2834238cd2d28b2a6f5c8899a506f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Jun 2023 18:10:35 +0800 Subject: vim-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. https://github.com/vim/vim/commit/f47c5a8e2d8eda7c2c8a9cccf9568eb56c03a0cf Co-authored-by: Bram Moolenaar --- test/old/testdir/test_listdict.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 4ed3991ee7..c86f938c03 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -1178,12 +1178,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:') -- cgit From aa7c4b88dc30cfe53a7c9bee6e49ad5b6bbca090 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Jun 2023 18:14:58 +0800 Subject: vim-patch:8.2.3853: Vim9: not enough tests Problem: Vim9: not enough tests. Solution: Run more existing tests for Vim9 script. https://github.com/vim/vim/commit/700e6b166298ecfb53fe4bf593085b29ca78d556 Cherry-pick test_listdict.vim change from patch 8.2.3854. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_listdict.vim | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index c86f938c03..07a365d337 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -1181,30 +1181,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 CheckDefAndScriptFailure(['var v = [4, 6][() => 1]'], ['E1012', 'E703:']) + + call CheckLegacyAndVim9Failure(['VAR v = range(5)[2 : []]'], ['E730:', 'E1012:', 'E730:']) - 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:') - 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:') - " Nvim doesn't have test_unknown() - " 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 -- cgit