Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net --- dlls/vbscript/global.c | 31 +++++++++++++++++++++++++++++-- dlls/vbscript/tests/api.vbs | 13 +++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 90cfd557038..222e0534665 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -425,6 +425,25 @@ HRESULT to_int(VARIANT *v, int *ret) return S_OK; }
+static HRESULT to_date(VARIANT *v, DATE *ret) +{ + VARIANT r; + HRESULT hres; + + V_VT(&r) = VT_EMPTY; + hres = VariantChangeType(&r, v, 0, VT_DATE); + if(FAILED(hres)) { + hres = VariantChangeType(&r, v, 0, VT_R8); + if(FAILED(hres)) + return hres; + hres = VariantChangeType(&r, &r, 0, VT_DATE); + if(FAILED(hres)) + return hres; + } + *ret = V_DATE(&r); + return S_OK; +} + static HRESULT to_double(VARIANT *v, double *ret) { VARIANT dst; @@ -935,8 +954,16 @@ static HRESULT Global_VarType(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt
static HRESULT Global_IsDate(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + DATE d; + + TRACE("%s\n", debugstr_variant(arg)); + + assert(args_cnt == 1); + + hres = to_date(arg, &d); + + return return_bool(res, SUCCEEDED(hres)); }
static HRESULT Global_IsEmpty(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index be1d4a806c0..d70f95ce69b 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -181,6 +181,19 @@ Call ok(not isObject(4), "isObject(4) is true?") Call ok(not isObject("x"), "isObject(""x"") is true?") Call ok(not isObject(Null), "isObject(Null) is true?")
+Call ok(not isDate(new EmptyClass), "isDate(new EmptyClass) is true?") +Set x = new EmptyClass +Call ok(not isDate(x), "isDate(x) is true?") +x = CDate(1) +Call ok(isDate(x), "isDate(x) is not true?") +Call ok(isDate(empty), "isDate(empty) is not true?") +Call ok(not isDate(Nothing), "isDate(Nothing) is true?") +Call ok(isDate(true), "isDate(true) is not true?") +Call ok(isDate(4), "isDate(4) is not true?") +Call ok(isDate("4"), "isDate(""4"") is not true?") +Call ok(not isDate("x"), "isDate(""x"") is true?") +Call ok(not isDate(Null), "isDate(Null) is true?") + Call ok(not isEmpty(new EmptyClass), "isEmpty(new EmptyClass) is true?") Set x = new EmptyClass Call ok(not isEmpty(x), "isEmpty(x) is true?") -- 2.36.1
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116197
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w7u_adm (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w7u_el (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w8 (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w8adm (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w864 (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064v1507 (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064v1809 (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064 (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064_tsign (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w10pro64 (32 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w864 (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064v1507 (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064v1809 (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064 (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064_2qxl (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064_adm (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w1064_tsign (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w10pro64 (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w10pro64_en_AE_u8 (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w10pro64_ar (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w10pro64_ja (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"
=== w10pro64_zh_CN (64 bit report) ===
vbscript: run.c:1204: Test failed: api.vbs: L"isDate(empty) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(true) is not true?" run.c:1204: Test failed: api.vbs: L"isDate(4) is not true?" run.c:1204: Test failed: api.vbs: L"isDate("4") is not true?"