Commit 6cc7b0e8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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

parent 17fb70ef
......@@ -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))
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment