1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2022-02-28 20:55:02 +00:00
parent 5de4c4372d
commit 1983f1aa31
5 changed files with 97 additions and 5 deletions

View File

@@ -550,6 +550,44 @@ def Test_call_ufunc_count()
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