diff options
Diffstat (limited to 'src/testdir/test_vim9_expr.vim')
-rw-r--r-- | src/testdir/test_vim9_expr.vim | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim index 711d5bad21..3c16fa48ea 100644 --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -122,7 +122,7 @@ def Test_expr1_vimscript() lines =<< trim END vim9script try - call eval('0 ? 1: 2') + eval('0 ? 1: 2') catch endtry assert_equal(v:true, eval(string(v:true))) @@ -132,7 +132,7 @@ def Test_expr1_vimscript() lines =<< trim END vim9script try - call eval('0 ? 1 :2') + eval('0 ? 1 :2') catch endtry assert_equal(v:true, eval(string(v:true))) @@ -480,7 +480,7 @@ def Test_expr4_equal() assert_equal(false, 'abc' ==# 'ABC') set noignorecase - call CheckDefFailure(["let x = 'a' == xxx"], 'E1001:', 1) + CheckDefFailure(["let x = 'a' == xxx"], 'E1001:', 1) let bb = 0z3f assert_equal(true, 0z3f == bb) @@ -1225,7 +1225,7 @@ def Test_expr6() * yf[0]) endif - call CheckDefFailure(["let x = 6 * xxx"], 'E1001', 1) + CheckDefFailure(["let x = 6 * xxx"], 'E1001', 1) enddef def Test_expr6_vim9script() @@ -1382,9 +1382,9 @@ def Test_expr7t() let nr = <number>234 assert_equal(234, nr) - call CheckDefFailure(["let x = <nr>123"], 'E1010:', 1) - call CheckDefFailure(["let x = <number >123"], 'E1068:', 1) - call CheckDefFailure(["let x = <number 123"], 'E1104:', 1) + CheckDefFailure(["let x = <nr>123"], 'E1010:', 1) + CheckDefFailure(["let x = <number >123"], 'E1068:', 1) + CheckDefFailure(["let x = <number 123"], 'E1104:', 1) enddef " test low level expression @@ -1416,7 +1416,7 @@ def Test_expr7_blob() assert_equal(g:blob_one, 0z01) assert_equal(g:blob_long, 0z0102.0304) - call CheckDefFailure(["let x = 0z123"], 'E973:', 1) + CheckDefFailure(["let x = 0z123"], 'E973:', 1) enddef def Test_expr7_string() @@ -1429,16 +1429,16 @@ def Test_expr7_string() assert_equal(g:string_long, "abcdefghijklm") assert_equal(g:string_special, "ab\ncd\ref\ekk") - call CheckDefFailure(['let x = "abc'], 'E114:', 1) - call CheckDefFailure(["let x = 'abc"], 'E115:', 1) + CheckDefFailure(['let x = "abc'], 'E114:', 1) + CheckDefFailure(["let x = 'abc"], 'E115:', 1) enddef def Test_expr7_vimvar() let old: list<string> = v:oldfiles let compl: dict<any> = v:completed_item - call CheckDefFailure(["let old: list<number> = v:oldfiles"], 'E1012: type mismatch, expected list<number> but got list<string>', 1) - call CheckDefFailure(["let old: dict<number> = v:completed_item"], 'E1012: type mismatch, expected dict<number> but got dict<any>', 1) + CheckDefFailure(["let old: list<number> = v:oldfiles"], 'E1012: type mismatch, expected list<number> but got list<string>', 1) + CheckDefFailure(["let old: dict<number> = v:completed_item"], 'E1012: type mismatch, expected dict<number> but got dict<any>', 1) enddef def Test_expr7_special() @@ -1460,11 +1460,11 @@ def Test_expr7_special() assert_equal(g:special_null, v:null) assert_equal(g:special_none, v:none) - call CheckDefFailure(['v:true = true'], 'E46:', 1) - call CheckDefFailure(['v:true = false'], 'E46:', 1) - call CheckDefFailure(['v:false = true'], 'E46:', 1) - call CheckDefFailure(['v:null = 11'], 'E46:', 1) - call CheckDefFailure(['v:none = 22'], 'E46:', 1) + CheckDefFailure(['v:true = true'], 'E46:', 1) + CheckDefFailure(['v:true = false'], 'E46:', 1) + CheckDefFailure(['v:false = true'], 'E46:', 1) + CheckDefFailure(['v:null = 11'], 'E46:', 1) + CheckDefFailure(['v:none = 22'], 'E46:', 1) enddef def Test_expr7_special_vim9script() @@ -1509,24 +1509,24 @@ def Test_expr7_list() 2] [3, 4] - call CheckDefFailure(["let x = 1234[3]"], 'E1107:', 1) - call CheckDefExecFailure(["let x = g:anint[3]"], 'E1062:', 1) + CheckDefFailure(["let x = 1234[3]"], 'E1107:', 1) + CheckDefExecFailure(["let x = g:anint[3]"], 'E1062:', 1) - call CheckDefFailure(["let x = g:list_mixed[xxx]"], 'E1001:', 1) + CheckDefFailure(["let x = g:list_mixed[xxx]"], 'E1001:', 1) - call CheckDefFailure(["let x = [1,2,3]"], 'E1069:', 1) - call CheckDefFailure(["let x = [1 ,2, 3]"], 'E1068:', 1) + CheckDefFailure(["let x = [1,2,3]"], 'E1069:', 1) + CheckDefFailure(["let x = [1 ,2, 3]"], 'E1068:', 1) - call CheckDefExecFailure(["echo 1", "let x = [][0]", "echo 3"], 'E684:', 2) + CheckDefExecFailure(["echo 1", "let x = [][0]", "echo 3"], 'E684:', 2) - call CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E1029:', 1) - call CheckDefFailure(["let x = g:list_mixed["], 'E1097:', 2) - call CheckDefFailure(["let x = g:list_mixed[0"], 'E1097:', 2) - call CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:', 1) - call CheckDefFailure(["let l: list<number> = [234, 'x']"], 'E1012:', 1) - call CheckDefFailure(["let l: list<number> = ['x', 234]"], 'E1012:', 1) - call CheckDefFailure(["let l: list<string> = [234, 'x']"], 'E1012:', 1) - call CheckDefFailure(["let l: list<string> = ['x', 123]"], 'E1012:', 1) + CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E1029:', 1) + CheckDefFailure(["let x = g:list_mixed["], 'E1097:', 2) + CheckDefFailure(["let x = g:list_mixed[0"], 'E1097:', 2) + CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:', 1) + CheckDefFailure(["let l: list<number> = [234, 'x']"], 'E1012:', 1) + CheckDefFailure(["let l: list<number> = ['x', 234]"], 'E1012:', 1) + CheckDefFailure(["let l: list<string> = [234, 'x']"], 'E1012:', 1) + CheckDefFailure(["let l: list<string> = ['x', 123]"], 'E1012:', 1) enddef def Test_expr7_list_vim9script() @@ -1647,9 +1647,9 @@ def Test_expr7_lambda() assert_equal(false, LambdaUsingArg(0)()) assert_equal(true, LambdaUsingArg(1)()) - call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:', 1) + CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:', 1) # error is in first line of the lambda - call CheckDefFailure(["let L = {a -> a + b}"], 'E1001:', 0) + CheckDefFailure(["let L = {a -> a + b}"], 'E1001:', 0) assert_equal('xxxyyy', 'xxx'->{a, b -> a .. b}('yyy')) @@ -1714,26 +1714,26 @@ def Test_expr7_dict() mixed = #{a: 234} mixed = #{} - call CheckDefFailure(["let x = #{a:8}"], 'E1069:', 1) - call CheckDefFailure(["let x = #{a : 8}"], 'E1068:', 1) - call CheckDefFailure(["let x = #{a :8}"], 'E1068:', 1) - call CheckDefFailure(["let x = #{a: 8 , b: 9}"], 'E1068:', 1) + CheckDefFailure(["let x = #{a:8}"], 'E1069:', 1) + CheckDefFailure(["let x = #{a : 8}"], 'E1068:', 1) + CheckDefFailure(["let x = #{a :8}"], 'E1068:', 1) + CheckDefFailure(["let x = #{a: 8 , b: 9}"], 'E1068:', 1) - call CheckDefFailure(["let x = #{8: 8}"], 'E1014:', 1) - call CheckDefFailure(["let x = #{xxx}"], 'E720:', 1) - call CheckDefFailure(["let x = #{xxx: 1", "let y = 2"], 'E722:', 2) - call CheckDefFailure(["let x = #{xxx: 1,"], 'E723:', 2) - call CheckDefFailure(["let x = {'a': xxx}"], 'E1001:', 1) - call CheckDefFailure(["let x = {xxx: 8}"], 'E1001:', 1) - call CheckDefFailure(["let x = #{a: 1, a: 2}"], 'E721:', 1) - call CheckDefFailure(["let x = #"], 'E1015:', 1) - call CheckDefExecFailure(["let x = g:anint.member"], 'E715:', 1) - call CheckDefExecFailure(["let x = g:dict_empty.member"], 'E716:', 1) + CheckDefFailure(["let x = #{8: 8}"], 'E1014:', 1) + CheckDefFailure(["let x = #{xxx}"], 'E720:', 1) + CheckDefFailure(["let x = #{xxx: 1", "let y = 2"], 'E722:', 2) + CheckDefFailure(["let x = #{xxx: 1,"], 'E723:', 2) + CheckDefFailure(["let x = {'a': xxx}"], 'E1001:', 1) + CheckDefFailure(["let x = {xxx: 8}"], 'E1001:', 1) + CheckDefFailure(["let x = #{a: 1, a: 2}"], 'E721:', 1) + CheckDefFailure(["let x = #"], 'E1015:', 1) + CheckDefExecFailure(["let x = g:anint.member"], 'E715:', 1) + CheckDefExecFailure(["let x = g:dict_empty.member"], 'E716:', 1) - call CheckDefFailure(['let x: dict<number> = #{a: 234, b: "1"}'], 'E1012:', 1) - call CheckDefFailure(['let x: dict<number> = #{a: "x", b: 134}'], 'E1012:', 1) - call CheckDefFailure(['let x: dict<string> = #{a: 234, b: "1"}'], 'E1012:', 1) - call CheckDefFailure(['let x: dict<string> = #{a: "x", b: 134}'], 'E1012:', 1) + CheckDefFailure(['let x: dict<number> = #{a: 234, b: "1"}'], 'E1012:', 1) + CheckDefFailure(['let x: dict<number> = #{a: "x", b: 134}'], 'E1012:', 1) + CheckDefFailure(['let x: dict<string> = #{a: 234, b: "1"}'], 'E1012:', 1) + CheckDefFailure(['let x: dict<string> = #{a: "x", b: 134}'], 'E1012:', 1) enddef def Test_expr7_dict_vim9script() @@ -1837,9 +1837,9 @@ def Test_expr_member() assert_equal('one', #{one: 'one'}.one) assert_equal('one', #{one: 'one'}[g:oneString]) - call CheckDefFailure(["let x = g:dict_one.#$!"], 'E1002:', 1) - call CheckDefExecFailure(["let d: dict<any>", "echo d['a']"], 'E716:', 2) - call CheckDefExecFailure(["let d: dict<number>", "d = g:list_empty"], 'E1029: Expected dict but got list', 2) + CheckDefFailure(["let x = g:dict_one.#$!"], 'E1002:', 1) + CheckDefExecFailure(["let d: dict<any>", "echo d['a']"], 'E716:', 2) + CheckDefExecFailure(["let d: dict<number>", "d = g:list_empty"], 'E1029: Expected dict but got list', 2) enddef def Test_expr7_any_index_slice() @@ -1991,7 +1991,7 @@ def Test_expr7_environment() assert_equal('testvar', $TESTVAR) assert_equal('', $ASDF_ASD_XXX) - call CheckDefFailure(["let x = $$$"], 'E1002:', 1) + CheckDefFailure(["let x = $$$"], 'E1002:', 1) enddef def Test_expr7_register() @@ -2006,7 +2006,7 @@ def Test_expr7_register() normal axyz assert_equal("xyz", @.) - call CheckDefFailure(["@. = 'yes'"], 'E354:', 1) + CheckDefFailure(["@. = 'yes'"], 'E354:', 1) @/ = 'slash' assert_equal('slash', @/) @@ -2091,11 +2091,11 @@ def Test_expr7_call() assert_equal(true, !range(5)->empty()) assert_equal([0, 1, 2], --3->range()) - call CheckDefFailure(["let x = 'yes'->Echo"], 'E107:', 1) - call CheckScriptFailure([ - "vim9script", - "let x = substitute ('x', 'x', 'x', 'x')" - ], 'E121:', 2) + CheckDefFailure(["let x = 'yes'->Echo"], 'E107:', 1) + CheckScriptFailure([ + "vim9script", + "let x = substitute ('x', 'x', 'x', 'x')" + ], 'E121:', 2) let auto_lines =<< trim END def g:some#func(): string |