[VBSCRIPT_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246

svn path=/trunk/; revision=67403
This commit is contained in:
Amine Khaldi 2015-04-25 11:03:24 +00:00
parent 1a597e49f1
commit f2599b4baa
4 changed files with 130 additions and 1 deletions

View File

@ -242,6 +242,7 @@ Call ok(x = 2, "InStr returned " & x)
x = InStr("abcd", "bc")
Call ok(x = 2, "InStr returned " & x)
Call ok(getVT(x) = "VT_I4*", "getVT(InStr) returned " & getVT(x))
x = InStr("abc", "bc")
Call ok(x = 2, "InStr returned " & x)
@ -281,6 +282,64 @@ Call ok(x = 2, "InStr returned " & x)
x = InStr(2.6, "abcd", "bc")
Call ok(x = 0, "InStr returned " & x)
x = InStrRev("bcabcd", "bc")
Call ok(x = 4, "InStrRev returned " & x)
Call ok(getVT(x) = "VT_I4*", "getVT(InStrRev) returned " & getVT(x))
x = InStrRev("bcabcd", "bc", 6)
Call ok(x = 4, "InStrRev returned " & x)
x = InStrRev("abcd", "bcx")
Call ok(x = 0, "InStrRev returned " & x)
x = InStrRev("abcd", "bc", 3)
Call ok(x = 2, "InStrRev returned " & x)
x = InStrRev("abcd", "bc", 2)
Call ok(x = 0, "InStrRev returned " & x)
x = InStrRev("abcd", "b", 2)
Call ok(x = 2, "InStrRev returned " & x)
x = InStrRev("abcd", "bc", 5)
Call ok(x = 0, "InStrRev returned " & x)
x = InStrRev("abcd", "bc", 15)
Call ok(x = 0, "InStrRev returned " & x)
x = "abcd"
x = InStrRev(x, "bc")
Call ok(x = 2, "InStrRev returned " & x)
x = InStrRev("abcd", "bc", 1.3)
Call ok(x = 0, "InStrRev returned " & x)
x = InStrRev("abcd", "bc", 2.3)
Call ok(x = 0, "InStrRev returned " & x)
x = InStrRev("abcd", "bc", 2.6)
Call ok(x = 2, "InStrRev returned " & x)
x = InStrRev("1234", 34)
Call ok(x = 3, "InStrRev returned " & x)
x = InStrRev(1234, 34)
Call ok(x = 3, "InStrRev returned " & x)
Sub testInStrRevError(arg1, arg2, arg3, error_num)
on error resume next
Dim x
Call Err.clear()
x = InStrRev(arg1, arg2, arg3)
Call ok(Err.number = error_num, "Err.number = " & Err.number)
End Sub
call testInStrRevError("abcd", null, 2, 94)
call testInStrRevError(null, "abcd", 2, 94)
call testInStrRevError("abcd", "abcd", null, 94)
Sub TestMid(str, start, len, ex)
x = Mid(str, start, len)
Call ok(x = ex, "Mid(" & str & ", " & start & ", " & len & ") = " & x & " expected " & ex)
@ -335,6 +394,7 @@ Call ok(Len("") = 0, "Len() = " & Len(""))
Call ok(Len(1) = 1, "Len(1) = " & Len(1))
Call ok(isNull(Len(null)), "Len(null) = " & Len(null))
Call ok(Len(empty) = 0, "Len(empty) = " & Len(empty))
Call ok(getVT(Len("abc")) = "VT_I4", "getVT(Len(abc)) = " & getVT(Len("abc")))
Call ok(Space(1) = " ", "Space(1) = " & Space(1) & """")
Call ok(Space(0) = "", "Space(0) = " & Space(0) & """")
@ -1240,4 +1300,28 @@ Call ok(getVT(Log(CByte(2))) = "VT_R8", "getVT(Log(CByte(2))) = " & getVT(Log(CB
Call ok(getVT(Date) = "VT_DATE", "getVT(Date) = " & getVT(Date))
Call ok(getVT(Time) = "VT_DATE", "getVT(Time) = " & getVT(Time))
Sub testRGBError(arg1, arg2, arg3, error_num)
on error resume next
Dim x
Call Err.clear()
x = RGB(arg1, arg2, arg3)
Call ok(Err.number = error_num, "Err.number1 = " & Err.number)
Call Err.clear()
Call RGB(arg1, arg2, arg3)
Call ok(Err.number = error_num, "Err.number2 = " & Err.number)
End Sub
Call ok(RGB(0, &h1f&, &hf1&) = &hf11f00&, "RGB(0, &h1f&, &hf1&) = " & RGB(0, &h1f&, &hf1&))
Call ok(getVT(RGB(0, &h1f&, &hf1&)) = "VT_I4", "getVT(RGB(&hf1&, &h1f&, &hf1&)) = " & getVT(RGB(&hf1&, &h1f&, &hf1&)))
Call ok(RGB(&hef&, &hab&, &hcd&) = &hcdabef&, "RGB(&hef&, &hab&, &hcd&) = " & RGB(&hef&, &hab&, &hcd&))
Call ok(getVT(RGB(&hef&, &hab&, &hcd&)) = "VT_I4", "getVT(RGB(&hef&, &hab&, &hcd&)) = " & getVT(RGB(&hef&, &hab&, &hcd&)))
Call ok(RGB(&h1&, &h100&, &h111&) = &hffff01&, "RGB(&h1&, &h100&, &h111&) = " & RGB(&h1&, &h100&, &h111&))
Call ok(getVT(RGB(&h1&, &h100&, &h111&)) = "VT_I4", "getVT(RGB(&h1&, &h100&, &h111&)) = " & getVT(RGB(&h1&, &h100&, &h111&)))
Call testRGBError(-1, &h1e&, &h3b&, 5)
Call testRGBError(&h4d&, -2, &h2f&, 5)
Call ok(getVT(Timer) = "VT_R4", "getVT(Timer) = " & getVT(Timer))
Call reportSuccess()

View File

@ -75,6 +75,7 @@ const RPC_S_SERVER_UNAVAILABLE = &h800706BA&
const CO_E_SERVER_EXEC_FAILURE = &h80080005&
call ok(Err.Number = 0, "Err.Number = " & Err.Number)
call ok(getVT(Err.Number) = "VT_I4", "getVT(Err.Number) = " & getVT(Err.Number))
dim calledFunc

View File

@ -234,6 +234,7 @@ if false then :
if false then x = y : if true then call ok(false, "embedded if called")
if false then x=1 else x=2 end if
if true then x=1 end if
x = false
if false then x = true : x = true

View File

@ -99,6 +99,7 @@ DEFINE_EXPECT(global_propargput_d);
DEFINE_EXPECT(global_propargput_i);
DEFINE_EXPECT(global_propargput1_d);
DEFINE_EXPECT(global_propargput1_i);
DEFINE_EXPECT(global_testoptionalarg_i);
DEFINE_EXPECT(collectionobj_newenum_i);
DEFINE_EXPECT(Next);
DEFINE_EXPECT(GetWindow);
@ -122,6 +123,7 @@ DEFINE_EXPECT(EnableModeless);
#define DISPID_GLOBAL_DOUBLEASSTRING 1014
#define DISPID_GLOBAL_TESTARRAY 1015
#define DISPID_GLOBAL_THROWINT 1016
#define DISPID_GLOBAL_TESTOPTIONALARG 1017
#define DISPID_TESTOBJ_PROPGET 2000
#define DISPID_TESTOBJ_PROPPUT 2001
@ -1014,6 +1016,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
*pid = DISPID_GLOBAL_THROWINT;
return S_OK;
}
if(!strcmp_wa(bstrName, "testOptionalArg")) {
test_grfdex(grfdex, fdexNameCaseInsensitive);
*pid = DISPID_GLOBAL_TESTOPTIONALARG;
return S_OK;
}
if(strict_dispid_check && strcmp_wa(bstrName, "x"))
ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
@ -1051,7 +1058,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
return S_OK;
}
case DISPID_GLOBAL_TRACE:
case DISPID_GLOBAL_TRACE:
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
@ -1327,6 +1334,30 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
return hres;
}
case DISPID_GLOBAL_TESTOPTIONALARG: {
VARIANT *v;
int opt;
CHECK_EXPECT(global_testoptionalarg_i);
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
ok(pdp->cArgs == 3, "cArgs = %d\n", pdp->cArgs);
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
ok(!pvarRes, "pvarRes != NULL\n");
ok(pei != NULL, "pei == NULL\n");
ok(V_VT(pdp->rgvarg) == VT_I2, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
opt = V_I2(pdp->rgvarg);
ok(opt == 1 || opt == 2, "opt = %d\n", opt);
v = pdp->rgvarg+pdp->cArgs-opt;
ok(V_VT(v) == VT_ERROR, "V_VT(v) = %d\n", V_VT(v));
ok(V_ERROR(v) == DISP_E_PARAMNOTFOUND, "V_ERROR(v) = %08x\n", V_ERROR(v));
return S_OK;
}
}
ok(0, "unexpected call %d\n", id);
@ -2082,6 +2113,18 @@ static void run_tests(void)
hres = parse_script_ar("throwInt(&h80004001&)");
ok(hres == MAKE_VBSERROR(445), "hres = %08x\n", hres);
SET_EXPECT(global_testoptionalarg_i);
parse_script_a("call testOptionalArg(1,,2)");
CHECK_CALLED(global_testoptionalarg_i);
SET_EXPECT(global_testoptionalarg_i);
parse_script_a("call testOptionalArg(,1,1)");
CHECK_CALLED(global_testoptionalarg_i);
SET_EXPECT(global_testoptionalarg_i);
parse_script_a("testOptionalArg 1,,2");
CHECK_CALLED(global_testoptionalarg_i);
strict_dispid_check = FALSE;
SET_EXPECT(testobj_value_i);