wscript: Added tests using vbscript.

This commit is contained in:
Jacek Caban 2011-10-19 13:16:30 +02:00 committed by Alexandre Julliard
parent 62b7069fa9
commit ec3d0e9b5c
3 changed files with 49 additions and 4 deletions

View File

@ -18,3 +18,6 @@
/* @makedep: run.js */
run.js TESTSCRIPT "run.js"
/* @makedep: run.vbs */
run.vbs TESTSCRIPT "run.vbs"

View File

@ -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);

View File

@ -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()