Jacek Caban : vbscript: Added more tests.
Alexandre Julliard
julliard at winehq.org
Fri Sep 9 10:56:47 CDT 2011
Module: wine
Branch: master
Commit: ddc47d6974571d0681003523edd7bb72fd8bb187
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ddc47d6974571d0681003523edd7bb72fd8bb187
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Sep 9 14:49:14 2011 +0200
vbscript: Added more tests.
---
dlls/vbscript/tests/lang.vbs | 5 ++++
dlls/vbscript/tests/run.c | 53 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 6f8b815..1c9512a 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -30,4 +30,9 @@ Call ok(false = false, "false = false is false")
Call ok(not (true = false), "true = false is true")
Call ok("x" = "x", """x"" = ""x"" is false")
+Call ok(getVT(false) = "VT_BOOL", "getVT(false) is not VT_BOOL")
+Call ok(getVT(true) = "VT_BOOL", "getVT(true) is not VT_BOOL")
+Call ok(getVT("") = "VT_BSTR", "getVT("""") is not VT_BSTR")
+Call ok(getVT("test") = "VT_BSTR", "getVT(""test"") is not VT_BSTR")
+
reportSuccess()
diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c
index b8cef40..329d75a 100644
--- a/dlls/vbscript/tests/run.c
+++ b/dlls/vbscript/tests/run.c
@@ -62,6 +62,7 @@ DEFINE_EXPECT(global_success_i);
#define DISPID_GLOBAL_REPORTSUCCESS 1000
#define DISPID_GLOBAL_TRACE 1001
#define DISPID_GLOBAL_OK 1002
+#define DISPID_GLOBAL_GETVT 1003
static const WCHAR testW[] = {'t','e','s','t',0};
@@ -87,6 +88,38 @@ static int strcmp_wa(LPCWSTR strw, const char *stra)
return lstrcmpA(buf, stra);
}
+static const char *vt2a(VARIANT *v)
+{
+ if(V_VT(v) == (VT_BYREF|VT_VARIANT)) {
+ static char buf[64];
+ sprintf(buf, "%s*", vt2a(V_BYREF(v)));
+ return buf;
+ }
+
+ switch(V_VT(v)) {
+ case VT_EMPTY:
+ return "VT_EMPTY";
+ case VT_NULL:
+ return "VT_NULL";
+ case VT_I2:
+ return "VT_I2";
+ case VT_I4:
+ return "VT_I4";
+ case VT_R8:
+ return "VT_R8";
+ case VT_BSTR:
+ return "VT_BSTR";
+ case VT_DISPATCH:
+ return "VT_DISPATCH";
+ case VT_BOOL:
+ return "VT_BOOL";
+ case VT_ARRAY|VT_VARIANT:
+ return "VT_ARRAY|VT_VARIANT";
+ default:
+ ok(0, "unknown vt %d\n", V_VT(v));
+ return NULL;
+ }
+}
#define test_grfdex(a,b) _test_grfdex(__LINE__,a,b)
static void _test_grfdex(unsigned line, DWORD grfdex, DWORD expect)
@@ -202,6 +235,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
*pid = DISPID_GLOBAL_REPORTSUCCESS;
return S_OK;
}
+ if(!strcmp_wa(bstrName, "getVT")) {
+ test_grfdex(grfdex, fdexNameCaseInsensitive);
+ *pid = DISPID_GLOBAL_GETVT;
+ return S_OK;
+ }
if(strict_dispid_check && strcmp_wa(bstrName, "x"))
ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
@@ -254,6 +292,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
trace("%s: %s\n", test_name, wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
return S_OK;
+
case DISPID_GLOBAL_REPORTSUCCESS:
CHECK_EXPECT(global_success_i);
@@ -266,6 +305,20 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
ok(pei != NULL, "pei == NULL\n");
return S_OK;
+
+ case DISPID_GLOBAL_GETVT:
+ ok(pdp != NULL, "pdp == NULL\n");
+ ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
+ ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
+ ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
+ ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
+ ok(pvarRes != NULL, "pvarRes == NULL\n");
+ ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
+ ok(pei != NULL, "pei == NULL\n");
+
+ V_VT(pvarRes) = VT_BSTR;
+ V_BSTR(pvarRes) = a2bstr(vt2a(pdp->rgvarg));
+ return S_OK;
}
ok(0, "unexpected call %d\n", id);
More information about the wine-cvs
mailing list