aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-12 18:14:58 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-06-12 18:17:40 +0800
commitaa7c4b88dc30cfe53a7c9bee6e49ad5b6bbca090 (patch)
treea84e22da245c35628d04b9cfcf0849077703a067
parentd83a196716e2834238cd2d28b2a6f5c8899a506f (diff)
downloadrneovim-aa7c4b88dc30cfe53a7c9bee6e49ad5b6bbca090.tar.gz
rneovim-aa7c4b88dc30cfe53a7c9bee6e49ad5b6bbca090.tar.bz2
rneovim-aa7c4b88dc30cfe53a7c9bee6e49ad5b6bbca090.zip
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 <Bram@vim.org>
-rw-r--r--test/old/testdir/test_listdict.vim35
1 files changed, 16 insertions, 19 deletions
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