From ec3d0e9b5cb339c6014c001c484b1fcfee60ed39 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 19 Oct 2011 13:16:30 +0200 Subject: [PATCH] wscript: Added tests using vbscript. --- programs/wscript/tests/rsrc.rc | 3 +++ programs/wscript/tests/run.c | 20 ++++++++++++++++---- programs/wscript/tests/run.vbs | 30 ++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 programs/wscript/tests/run.vbs diff --git a/programs/wscript/tests/rsrc.rc b/programs/wscript/tests/rsrc.rc index b1df1c5dd5a..87e9a73aaa4 100644 --- a/programs/wscript/tests/rsrc.rc +++ b/programs/wscript/tests/rsrc.rc @@ -18,3 +18,6 @@ /* @makedep: run.js */ run.js TESTSCRIPT "run.js" + +/* @makedep: run.vbs */ +run.vbs TESTSCRIPT "run.vbs" diff --git a/programs/wscript/tests/run.c b/programs/wscript/tests/run.c index b7d3c3c4b51..163be22c889 100644 --- a/programs/wscript/tests/run.c +++ b/programs/wscript/tests/run.c @@ -170,16 +170,28 @@ static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REF WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { switch(dispIdMember) { - case DISPID_TESTOBJ_OK: + case DISPID_TESTOBJ_OK: { + VARIANT *expr, *msg; + ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags); ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs); ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); - ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg)); - ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg)); - ok(V_BOOL(pdp->rgvarg+1), "%s: %s\n", script_name, wine_dbgstr_w(V_BSTR(pdp->rgvarg))); + + expr = pdp->rgvarg+1; + if(V_VT(expr) == (VT_VARIANT|VT_BYREF)) + expr = V_VARIANTREF(expr); + + msg = pdp->rgvarg; + if(V_VT(msg) == (VT_VARIANT|VT_BYREF)) + msg = V_VARIANTREF(msg); + + ok(V_VT(msg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(msg)); + ok(V_VT(expr) == VT_BOOL, "V_VT(psp->rgvargs+1) = %d\n", V_VT(expr)); + ok(V_BOOL(expr), "%s: %s\n", script_name, wine_dbgstr_w(V_BSTR(msg))); if(pVarResult) V_VT(pVarResult) = VT_EMPTY; break; + } case DISPID_TESTOBJ_TRACE: ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags); ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs); diff --git a/programs/wscript/tests/run.vbs b/programs/wscript/tests/run.vbs new file mode 100644 index 00000000000..785df78d4df --- /dev/null +++ b/programs/wscript/tests/run.vbs @@ -0,0 +1,30 @@ +' +' Copyright 2011 Jacek Caban for CodeWeavers +' +' This library is free software; you can redistribute it and/or +' modify it under the terms of the GNU Lesser General Public +' License as published by the Free Software Foundation; either +' version 2.1 of the License, or (at your option) any later version. +' +' This library is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +' Lesser General Public License for more details. +' +' You should have received a copy of the GNU Lesser General Public +' License along with this library; if not, write to the Free Software +' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +' + +Option Explicit + +Dim winetest +Set winetest = CreateObject("Wine.Test") + +Sub ok(expr, msg) + Call winetest.ok(expr, msg) +End Sub + +Call ok(WScript is WSH, "WScript is not WSH") + +Call winetest.reportSuccess() -- 2.11.4.GIT