0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.1454: Vim9: failure invoking lambda with wrong arguments

Problem:    Vim9: failure invoking lambda with wrong arguments.
Solution:   Handle invalid arguments.  Add a test.
This commit is contained in:
Bram Moolenaar
2020-08-14 22:16:33 +02:00
parent 8de2f44ac6
commit 79e8db9a21
4 changed files with 17 additions and 1 deletions

View File

@@ -1584,6 +1584,14 @@ def Test_expr7_lambda()
call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:')
call CheckDefFailure(["let L = {a -> a + b}"], 'E1001:')
assert_equal('xxxyyy', 'xxx'->{a, b -> a .. b}('yyy'))
CheckDefExecFailure(["let s = 'asdf'->{a -> a}('x')"],
'E1106: one argument too many')
CheckDefExecFailure(["let s = 'asdf'->{a -> a}('x', 'y')"],
'E1106: 2 arguments too many')
CheckDefFailure(["echo 'asdf'->{a -> a}(x)"], 'E1001:')
enddef
def Test_expr7_lambda_vim9script()