patch 8.2.4484: Vim9: some error messages are not tested
Problem: Vim9: some error messages are not tested.
Solution: Add a few more test cases. Delete dead code.
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 7488397..866cf4c 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -550,6 +550,44 @@
unlet g:counter
enddef
+def Test_call_ufunc_failure()
+ var lines =<< trim END
+ vim9script
+ def Tryit()
+ g:Global(1, 2, 3)
+ enddef
+
+ func g:Global(a, b, c)
+ echo a:a a:b a:c
+ endfunc
+
+ defcompile
+
+ func! g:Global(a, b)
+ echo a:a a:b
+ endfunc
+ Tryit()
+ END
+ v9.CheckScriptFailure(lines, 'E118: Too many arguments for function: Global')
+ delfunc g:Global
+
+ lines =<< trim END
+ vim9script
+
+ g:Ref = function('len')
+ def Tryit()
+ g:Ref('x')
+ enddef
+
+ defcompile
+
+ g:Ref = function('add')
+ Tryit()
+ END
+ v9.CheckScriptFailure(lines, 'E119: Not enough arguments for function: add')
+ unlet g:Ref
+enddef
+
def s:MyVarargs(arg: string, ...rest: list<string>): string
var res = arg
for s in rest