summaryrefslogtreecommitdiff
path: root/src/testdir/test_vim9_expr.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-14 22:16:33 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-14 22:16:33 +0200
commit79e8db9a218ef111934594024a5cd8b1f93acada (patch)
tree980ed11ba0d24efa15ee4e10f628f54553ac697f /src/testdir/test_vim9_expr.vim
parent8de2f44ac6af2276587a2e44a0d5fe1dc6789eb3 (diff)
downloadvim-git-79e8db9a218ef111934594024a5cd8b1f93acada.tar.gz
patch 8.2.1454: Vim9: failure invoking lambda with wrong argumentsv8.2.1454
Problem: Vim9: failure invoking lambda with wrong arguments. Solution: Handle invalid arguments. Add a test.
Diffstat (limited to 'src/testdir/test_vim9_expr.vim')
-rw-r--r--src/testdir/test_vim9_expr.vim8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 48c1cf219..fb07586bc 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -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()