Jacek Caban : vbscript: Added Global_isNull implementation.

Alexandre Julliard julliard at winehq.org
Thu Oct 20 14:25:10 CDT 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct 20 12:57:18 2011 +0200

vbscript: Added Global_isNull implementation.

---

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

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 98f41f2..56cedf6 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -291,8 +291,15 @@ static HRESULT Global_IsEmpty(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, V
 
 static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    TRACE("(%s)\n", debugstr_variant(arg));
+
+    assert(args_cnt == 1);
+
+    if(res) {
+        V_VT(res) = VT_BOOL;
+        V_BOOL(res) = V_VT(arg) == VT_NULL ? VARIANT_TRUE : VARIANT_FALSE;
+    }
+    return S_OK;
 }
 
 static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs
index d5b75db..126f1e0 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -44,6 +44,18 @@ Call ok(not isEmpty(4), "isEmpty(4) is true?")
 Call ok(not isEmpty("x"), "isEmpty(""x"") is true?")
 Call ok(not isEmpty(Null), "isEmpty(Null) is true?")
 
+Call ok(not isNull(new EmptyClass), "isNull(new EmptyClass) is true?")
+Set x = new EmptyClass
+Call ok(not isNull(x), "isNull(x) is true?")
+x = null
+Call ok(isNull(x), "isNull(x) is not true?")
+Call ok(not isNull(empty), "isNull(empty) is true?")
+Call ok(not isNull(Nothing), "isNull(Nothing) is true?")
+Call ok(not isNull(true), "isNull(true) is true?")
+Call ok(not isNull(4), "isNull(4) is true?")
+Call ok(not isNull("x"), "isNull(""x"") is true?")
+Call ok(isNull(Null), "isNull(Null) is not true?")
+
 Call ok(getVT(err) = "VT_DISPATCH", "getVT(err) = " & getVT(err))
 
 Sub TestHex(x, ex)




More information about the wine-cvs mailing list