vbscript: Return correct error when builtin call argument count is invalid.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-08-21 20:22:18 +02:00 committed by Alexandre Julliard
parent 17fb70efe6
commit 6cc7b0e8d5
2 changed files with 24 additions and 2 deletions

View File

@ -237,6 +237,17 @@ Call ok(UBound(arr2) = 2, "UBound(x) = " & UBound(x))
Call ok(UBound(arr2, 1) = 2, "UBound(x) = " & UBound(x))
Call ok(UBound(arr2, 2) = 4, "UBound(x) = " & UBound(x))
sub testUBoundError()
on error resume next
call Err.clear()
call UBound()
call ok(Err.number = 450, "Err.number = " & Err.number)
call Err.clear()
call UBound(arr, 1, 2)
call ok(Err.number = 450, "Err.number = " & Err.number)
end sub
call testUBoundError()
Dim newObject
Set newObject = New ValClass
newObject.myval = 1
@ -494,6 +505,17 @@ TestStrComp "ABC", Empty, 1, 1
TestStrComp vbNull, vbNull, 1, 0
TestStrComp "", vbNull, 1, -1
sub testStrCompError()
on error resume next
call Err.clear()
call StrComp()
call ok(Err.number = 450, "Err.number = " & Err.number)
call Err.clear()
call StrComp("a", "a", 0, 1)
call ok(Err.number = 450, "Err.number = " & Err.number)
end sub
call testStrCompError()
Call ok(Len("abc") = 3, "Len(abc) = " & Len("abc"))
Call ok(Len("") = 0, "Len() = " & Len(""))
Call ok(Len(1) = 1, "Len(1) = " & Len(1))

View File

@ -232,8 +232,8 @@ static HRESULT invoke_builtin(vbdisp_t *This, const builtin_prop_t *prop, WORD f
argn = arg_cnt(dp);
if(argn < prop->min_args || argn > (prop->max_args ? prop->max_args : prop->min_args)) {
FIXME("invalid number of arguments\n");
return E_FAIL;
WARN("invalid number of arguments\n");
return MAKE_VBSERROR(VBSE_FUNC_ARITY_MISMATCH);
}
assert(argn < ARRAY_SIZE(args));