Commit c56d0972 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

vbscript: Handle negative argument in Space().

parent 132539b0
......@@ -1586,14 +1586,17 @@ static HRESULT Global_Space(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt,
TRACE("%s\n", debugstr_variant(arg));
assert(args_cnt == 1);
if(V_VT(arg) == VT_NULL)
return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE);
hres = to_int(arg, &n);
if(FAILED(hres))
return hres;
if(n < 0) {
FIXME("n = %d\n", n);
return E_NOTIMPL;
}
if(n < 0)
return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
if(!res)
return S_OK;
......
......@@ -747,6 +747,21 @@ Call ok(Space(4.5) = " ", "Space(4.5) = " & Space(4.5) & """")
Call ok(Space(0.5) = "", "Space(0.5) = " & Space(0.5) & """")
Call ok(Space(1.5) = " ", "Space(1.5) = " & Space(1.5) & """")
Call ok(Space("1") = " ", "Space(""1"") = " & Space("1") & """")
Call ok(Space(Empty) = "", "Space(Empty) = " & Space(Empty) & """")
sub testSpaceError()
on error resume next
call Err.clear()
call Space(-1)
call ok(Err.number = 5, "Err.number = " & Err.number)
call Err.clear()
call Space("-1")
call ok(Err.number = 5, "Err.number = " & Err.number)
call Err.clear()
call Space(Null)
call ok(Err.number = 94, "Err.number = " & Err.number)
end sub
call testSpaceError()
sub test_string(cnt, char, exp)
call ok(String(cnt, char) = exp, "String(" & cnt & ", """ & char & """ = """ & _
......
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