[PATCH] vbscript: Implement IsArray.

Robert Wilhelm robert.wilhelm at gmx.net
Sat Aug 22 04:14:20 CDT 2020


Signed-off-by: Robert Wilhelm <robert.wilhelm at gmx.net>
---
 dlls/vbscript/global.c      | 11 +++++++++--
 dlls/vbscript/tests/api.vbs | 15 +++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 17e4f4aba8..d4b9344206 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -961,8 +961,15 @@ static HRESULT Global_IsNumeric(BuiltinDisp *This, VARIANT *arg, unsigned args_c

 static HRESULT Global_IsArray(BuiltinDisp *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_ISARRAY(arg) ? VARIANT_TRUE : VARIANT_FALSE;
+    }
+    return S_OK;
 }

 static HRESULT Global_IsObject(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs
index 787da7cd71..6add0579e8 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -223,6 +223,21 @@ arr(0) = 2
 arr(1) = 3
 Call ok(not isNumeric(arr), "isNumeric(arr) is not true?")

+Call ok(isArray(arr), "isArray(arr) is not true?")
+x = Array()
+Call ok(isArray(arr), "isArray(Array()) is not true?")
+Call ok(not isArray(Empty), "isArray(empty) is true?")
+Call ok(not isArray(Null), "isArray(Null) is true?")
+Call ok(not isArray(42), "isArray(42) is true?")
+Call ok(not isArray(CSng(3242.4)), "isArray(CSng(3242.4)) is true?")
+Call ok(not isArray(CCur(32768.4)), "isArray(CCur(32768.4)) is true?")
+Call ok(not isArray("44"), "isArray(""44"") is true?")
+Call ok(not isArray("rwrf"), "isArray(""rwrf"") is true?")
+Call ok(not isArray(Nothing), "isArray(Nothing) is true?")
+Call ok(not isArray(New EmptyClass), "isArray(New EmptyClass) is true?")
+Call ok(not isArray(true), "isArray(true) is true?")
+Call ok(not isArray(CByte(32)), "isArray(CByte(32)) is true?")
+
 Call ok(getVT(Array()) = "VT_ARRAY|VT_VARIANT", "getVT(Array()) = " & getVT(Array()))
 x = Array("a1", 2, "a3")
 Call ok(getVT(x) = "VT_ARRAY|VT_VARIANT*", "getVT(array) = " & getVT(x))
--
2.26.2





More information about the wine-devel mailing list