Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/vbscript/global.c | 11 +++++++---- dlls/vbscript/tests/api.vbs | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 15c0bb0958e..80348a5288f 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -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; diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 3b67e920c3d..617589053c6 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -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 & """ = """ & _