Commit 5d31c1e8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Return proper error on invalid argument in Chr.

parent 3ca67bc8
......@@ -1141,8 +1141,8 @@ static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
return hres;
if(c < 0 || c >= 0x100) {
FIXME("invalid arg\n");
return E_FAIL;
WARN("invalid arg %d\n", c);
return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
}
if(res) {
......
......@@ -137,6 +137,20 @@ Call ok(Chr(0) <> "", "Chr(0) = """"")
Call ok(Chr(120.5) = "x", "Chr(120.5) = " & Chr(120.5))
Call ok(Chr(119.5) = "x", "Chr(119.5) = " & Chr(119.5))
sub testChrError
on error resume next
call Err.clear()
call Chr(-1)
call ok(Err.number = 5, "Err.number = " & Err.number)
call Err.clear()
call Chr(256)
call ok(Err.number = 5, "Err.number = " & Err.number)
end sub
call testChrError
Call ok(isObject(new EmptyClass), "isObject(new EmptyClass) is not true?")
Set x = new EmptyClass
Call ok(isObject(x), "isObject(x) is not true?")
......
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