Robert Wilhelm : vbscript: Implement IsDate().

Alexandre Julliard julliard at winehq.org
Mon Jun 6 16:10:30 CDT 2022


Module: wine
Branch: master
Commit: f3ea0996b1bb9b675363ab329404bb659fb95657
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f3ea0996b1bb9b675363ab329404bb659fb95657

Author: Robert Wilhelm <robert.wilhelm at gmx.net>
Date:   Sat Jun  4 20:45:41 2022 +0200

vbscript: Implement IsDate().

Signed-off-by: Robert Wilhelm <robert.wilhelm at gmx.net>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vbscript/global.c      |  9 +++++++--
 dlls/vbscript/tests/api.vbs | 14 ++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 90cfd557038..731a062dea2 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -935,8 +935,13 @@ 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;
+    TRACE("%s\n", debugstr_variant(arg));
+
+    if(res) {
+        V_VT(res) = VT_BOOL;
+        V_BOOL(res) = V_VT(arg) == VT_DATE ? VARIANT_TRUE : VARIANT_FALSE;
+    }
+    return S_OK;
 }
 
 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..b9c2149aa56 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -181,6 +181,20 @@ 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(#1/1/2000#), "isDate(#1/1/2000#) is not true?")
+Call ok(not isDate(empty), "isDate(empty) is true?")
+Call ok(not isDate(Nothing), "isDate(Nothing) is true?")
+Call ok(not isDate(true), "isDate(true) is true?")
+Call ok(not isDate(4), "isDate(4) is true?")
+Call ok(not isDate("4"), "isDate(""4"") is 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?")




More information about the wine-cvs mailing list