mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
[VBSCRIPT_WINETEST] Sync with Wine Staging 1.7.47. CORE-9924
svn path=/trunk/; revision=68537
This commit is contained in:
parent
b9357adadb
commit
9aa1d41ab8
3 changed files with 184 additions and 0 deletions
|
@ -233,10 +233,61 @@ TestHex -1, "FFFF"
|
|||
TestHex -16, "FFF0"
|
||||
TestHex -934859845, "C8472BBB"
|
||||
TestHex empty, "0"
|
||||
TestHex "17", "11"
|
||||
TestHex 228.5, "E4"
|
||||
TestHex -32767, "8001"
|
||||
TestHex -32768, "FFFF8000"
|
||||
TestHex 2147483647.49, "7FFFFFFF"
|
||||
TestHex -2147483647.5, "80000000"
|
||||
newObject.myval = 30.5
|
||||
TestHex newObject, "1E"
|
||||
newObject.myval = "27"
|
||||
TestHex newObject, "1B"
|
||||
|
||||
|
||||
Call ok(getVT(hex(null)) = "VT_NULL", "getVT(hex(null)) = " & getVT(hex(null)))
|
||||
Call ok(getVT(hex(empty)) = "VT_BSTR", "getVT(hex(empty)) = " & getVT(hex(empty)))
|
||||
|
||||
Sub TestHexError(num, err_num)
|
||||
On Error Resume Next
|
||||
Call Hex(num)
|
||||
Call ok(Err.number = err_num, "Hex(" & num & ") returns error number " & Err.number & " expected " & err_num)
|
||||
End Sub
|
||||
|
||||
TestHexError 2147483647.5, 6
|
||||
TestHexError 2147483648.51, 6
|
||||
TestHexError "test", 13
|
||||
|
||||
Sub TestOct(x, ex, res_type)
|
||||
Call ok(Oct(x) = ex, "Oct(" & x & ") = " & Oct(x) & " expected " & ex)
|
||||
Call ok(getVT(Oct(x)) = res_type, "getVT(Oct(" &x & ")) = " & getVT(Oct(x)) & "expected " & res_type)
|
||||
End Sub
|
||||
|
||||
Sub TestOctError(num, err_num)
|
||||
On error resume next
|
||||
Call Oct(num)
|
||||
Call ok(Err.number = err_num, "Oct(" & num & ") error number is " & Err.number & " expected " & err_num)
|
||||
End Sub
|
||||
|
||||
TestOct empty, "0", "VT_BSTR"
|
||||
TestOct 0, "0", "VT_BSTR"
|
||||
TestOct 9, "11", "VT_BSTR"
|
||||
TestOct "9", "11", "VT_BSTR"
|
||||
TestOct 8.5, "10", "VT_BSTR"
|
||||
TestOct 9.5, "12", "VT_BSTR"
|
||||
TestOct -1, "177777", "VT_BSTR"
|
||||
TestOct -32767, "100001", "VT_BSTR"
|
||||
TestOct -32768, "37777700000", "VT_BSTR"
|
||||
TestOct 2147483647.49, "17777777777", "VT_BSTR"
|
||||
TestOct -2147483648.5, "20000000000", "VT_BSTR"
|
||||
Call ok(getVT(Oct(null)) = "VT_NULL", "getVT(Oct(null)) = " & getVT(Oct(null)))
|
||||
newObject.myval = 5
|
||||
TestOct newObject, "5", "VT_BSTR"
|
||||
|
||||
TestOctError 2147483647.5, 6
|
||||
TestOctError -2147483648.51, 6
|
||||
TestOctError "test", 13
|
||||
|
||||
x = InStr(1, "abcd", "bc")
|
||||
Call ok(x = 2, "InStr returned " & x)
|
||||
|
||||
|
|
|
@ -174,4 +174,21 @@ Call ok(x.IgnoreCase = false, "RegExp.IgnoreCase = " & x.IgnoreCase)
|
|||
Call ok(x.Global = false, "RegExp.Global = " & x.Global)
|
||||
Call ok(x.Multiline = false, "RegExp.Multiline = " & x.Multiline)
|
||||
|
||||
set matches = x.execute("test")
|
||||
Call ok(matches.Count = 1, "matches.Count = " & matches.Count)
|
||||
x.pattern = ""
|
||||
set matches = x.execute("test")
|
||||
Call ok(matches.Count = 1, "matches.Count = " & matches.Count)
|
||||
set match = matches.item(0)
|
||||
Call ok(match.Value = "", "match.Value = " & match.Value)
|
||||
x.global = true
|
||||
set matches = x.execute("test")
|
||||
Call ok(matches.Count = 5, "matches.Count = " & matches.Count)
|
||||
set match = matches.item(0)
|
||||
Call ok(match.Value = "", "match.Value = " & match.Value)
|
||||
set match = matches.item(4)
|
||||
Call ok(match.Value = "", "match.Value = " & match.Value)
|
||||
matches = x.test("test")
|
||||
Call ok(matches = true, "matches = " & matches)
|
||||
|
||||
Call reportSuccess()
|
||||
|
|
|
@ -90,6 +90,8 @@ DEFINE_EXPECT(global_success_d);
|
|||
DEFINE_EXPECT(global_success_i);
|
||||
DEFINE_EXPECT(global_vbvar_d);
|
||||
DEFINE_EXPECT(global_vbvar_i);
|
||||
DEFINE_EXPECT(global_letobj_i);
|
||||
DEFINE_EXPECT(global_setobj_i);
|
||||
DEFINE_EXPECT(testobj_propget_d);
|
||||
DEFINE_EXPECT(testobj_propget_i);
|
||||
DEFINE_EXPECT(testobj_propput_d);
|
||||
|
@ -124,6 +126,8 @@ DEFINE_EXPECT(EnableModeless);
|
|||
#define DISPID_GLOBAL_TESTARRAY 1015
|
||||
#define DISPID_GLOBAL_THROWINT 1016
|
||||
#define DISPID_GLOBAL_TESTOPTIONALARG 1017
|
||||
#define DISPID_GLOBAL_LETOBJ 1018
|
||||
#define DISPID_GLOBAL_SETOBJ 1019
|
||||
|
||||
#define DISPID_TESTOBJ_PROPGET 2000
|
||||
#define DISPID_TESTOBJ_PROPPUT 2001
|
||||
|
@ -140,6 +144,7 @@ static BOOL strict_dispid_check, is_english, allow_ui;
|
|||
static const char *test_name = "(null)";
|
||||
static int test_counter;
|
||||
static SCRIPTUICHANDLING uic_handling = SCRIPTUICHANDLING_NOUIERROR;
|
||||
static IDispatchEx testObj;
|
||||
|
||||
static BSTR a2bstr(const char *str)
|
||||
{
|
||||
|
@ -340,9 +345,60 @@ static void test_disp(IDispatch *disp)
|
|||
ok(hres == DISP_E_MEMBERNOTFOUND, "InvokeEx failed: %08x, expected DISP_E_MEMBERNOTFOUND\n", hres);
|
||||
ok(V_VT(&v) == VT_EMPTY, "V_VT(v) = %d\n", V_VT(&v));
|
||||
|
||||
SET_EXPECT(testobj_value_i);
|
||||
V_VT(args) = VT_DISPATCH;
|
||||
V_DISPATCH(args) = (IDispatch*)&testObj;
|
||||
dp.cArgs = dp.cNamedArgs = 1;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, NULL);
|
||||
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
||||
CHECK_CALLED(testobj_value_i);
|
||||
|
||||
dp.cArgs = dp.cNamedArgs = 0;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYGET, &dp, &v, &ei, NULL);
|
||||
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
||||
ok(V_VT(&v) == VT_I2, "V_VT(v) = %d\n", V_VT(&v));
|
||||
ok(V_I2(&v) == 0, "V_I2(v) = %d\n", V_I2(&v));
|
||||
|
||||
V_VT(args) = VT_DISPATCH;
|
||||
V_DISPATCH(args) = (IDispatch*)&testObj;
|
||||
dp.cArgs = dp.cNamedArgs = 1;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &dp, NULL, &ei, NULL);
|
||||
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
||||
|
||||
V_VT(args) = VT_DISPATCH;
|
||||
V_DISPATCH(args) = (IDispatch*)&testObj;
|
||||
dp.cArgs = dp.cNamedArgs = 1;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYPUTREF, &dp, NULL, &ei, NULL);
|
||||
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
||||
|
||||
dp.cArgs = dp.cNamedArgs = 0;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYGET, &dp, &v, &ei, NULL);
|
||||
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
||||
ok(V_VT(&v) == VT_DISPATCH, "V_VT(v) = %d\n", V_VT(&v));
|
||||
ok(V_DISPATCH(&v) == (IDispatch*)&testObj, "V_DISPATCH(v) != testObj\n");
|
||||
|
||||
V_VT(args) = VT_BOOL;
|
||||
V_BOOL(args) = VARIANT_TRUE;
|
||||
dp.cArgs = dp.cNamedArgs = 1;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &dp, NULL, &ei, NULL);
|
||||
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
||||
|
||||
dp.cArgs = dp.cNamedArgs = 0;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYGET, &dp, &v, &ei, NULL);
|
||||
ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
|
||||
ok(V_VT(&v) == VT_BOOL, "V_VT(v) = %d\n", V_VT(&v));
|
||||
ok(V_BOOL(&v) == VARIANT_TRUE, "V_BOOL(v) = %x\n", V_BOOL(&v));
|
||||
|
||||
V_VT(args) = VT_BOOL;
|
||||
V_BOOL(args) = VARIANT_FALSE;
|
||||
dp.cArgs = dp.cNamedArgs = 1;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYPUTREF, &dp, NULL, &ei, NULL);
|
||||
ok(hres == DISP_E_EXCEPTION, "InvokeEx failed: %08x, expected DISP_E_EXCEPTION\n", hres);
|
||||
|
||||
V_VT(args) = VT_BOOL;
|
||||
V_BOOL(args) = VARIANT_FALSE;
|
||||
dp.cArgs = 1;
|
||||
dp.cNamedArgs = 0;
|
||||
V_VT(&v) = VT_BOOL;
|
||||
hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, NULL);
|
||||
ok(hres == DISP_E_PARAMNOTOPTIONAL, "InvokeEx failed: %08x, expected DISP_E_PARAMNOTOPTIONAL\n", hres);
|
||||
|
@ -969,6 +1025,16 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
|
|||
*pid = DISPID_GLOBAL_VBVAR;
|
||||
return S_OK;
|
||||
}
|
||||
if(!strcmp_wa(bstrName, "letobj")) {
|
||||
test_grfdex(grfdex, fdexNameCaseInsensitive);
|
||||
*pid = DISPID_GLOBAL_LETOBJ;
|
||||
return S_OK;
|
||||
}
|
||||
if(!strcmp_wa(bstrName, "setobj")) {
|
||||
test_grfdex(grfdex, fdexNameCaseInsensitive);
|
||||
*pid = DISPID_GLOBAL_SETOBJ;
|
||||
return S_OK;
|
||||
}
|
||||
if(!strcmp_wa(bstrName, "isNullDisp")) {
|
||||
test_grfdex(grfdex, fdexNameCaseInsensitive);
|
||||
*pid = DISPID_GLOBAL_ISNULLDISP;
|
||||
|
@ -1131,6 +1197,40 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
|
|||
ok(V_I2(pdp->rgvarg) == 3, "V_I2(psp->rgvargs) = %d\n", V_I2(pdp->rgvarg));
|
||||
return S_OK;
|
||||
|
||||
case DISPID_GLOBAL_LETOBJ:
|
||||
CHECK_EXPECT(global_letobj_i);
|
||||
|
||||
ok(wFlags == DISPATCH_PROPERTYPUT, "wFlags = %x\n", wFlags);
|
||||
ok(pdp != NULL, "pdp == NULL\n");
|
||||
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
||||
ok(pdp->rgdispidNamedArgs != NULL, "rgdispidNamedArgs == NULL\n");
|
||||
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
||||
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
||||
ok(pdp->rgdispidNamedArgs[0] == DISPID_PROPERTYPUT, "pdp->rgdispidNamedArgs[0] = %d\n", pdp->rgdispidNamedArgs[0]);
|
||||
ok(!pvarRes, "pvarRes != NULL\n");
|
||||
ok(pei != NULL, "pei == NULL\n");
|
||||
|
||||
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
|
||||
ok(V_DISPATCH(pdp->rgvarg) == (IDispatch*)&testObj, "V_DISPATCH(psp->rgvargs) != testObj\n");
|
||||
return S_OK;
|
||||
|
||||
case DISPID_GLOBAL_SETOBJ:
|
||||
CHECK_EXPECT(global_setobj_i);
|
||||
|
||||
ok(wFlags == DISPATCH_PROPERTYPUTREF, "wFlags = %x\n", wFlags);
|
||||
ok(pdp != NULL, "pdp == NULL\n");
|
||||
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
||||
ok(pdp->rgdispidNamedArgs != NULL, "rgdispidNamedArgs == NULL\n");
|
||||
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
||||
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
||||
ok(pdp->rgdispidNamedArgs[0] == DISPID_PROPERTYPUT, "pdp->rgdispidNamedArgs[0] = %d\n", pdp->rgdispidNamedArgs[0]);
|
||||
ok(!pvarRes, "pvarRes != NULL\n");
|
||||
ok(pei != NULL, "pei == NULL\n");
|
||||
|
||||
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
|
||||
ok(V_DISPATCH(pdp->rgvarg) == (IDispatch*)&testObj, "V_DISPATCH(psp->rgvargs) != testObj\n");
|
||||
return S_OK;
|
||||
|
||||
case DISPID_GLOBAL_TESTOBJ:
|
||||
ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", wFlags);
|
||||
|
||||
|
@ -2034,6 +2134,22 @@ static void run_tests(void)
|
|||
CHECK_CALLED(global_vbvar_d);
|
||||
CHECK_CALLED(global_vbvar_i);
|
||||
|
||||
SET_EXPECT(global_letobj_i);
|
||||
parse_script_a("Option Explicit\nletobj = testObj");
|
||||
CHECK_CALLED(global_letobj_i);
|
||||
|
||||
SET_EXPECT(global_letobj_i);
|
||||
parse_script_a("Option Explicit\ntest.letobj = testObj");
|
||||
CHECK_CALLED(global_letobj_i);
|
||||
|
||||
SET_EXPECT(global_setobj_i);
|
||||
parse_script_a("Option Explicit\nset setobj = testObj");
|
||||
CHECK_CALLED(global_setobj_i);
|
||||
|
||||
SET_EXPECT(global_setobj_i);
|
||||
parse_script_a("Option Explicit\nset test.setobj = testObj");
|
||||
CHECK_CALLED(global_setobj_i);
|
||||
|
||||
SET_EXPECT(testobj_propget_d);
|
||||
SET_EXPECT(testobj_propget_i);
|
||||
parse_script_a("dim x\nx = testObj.propget");
|
||||
|
|
Loading…
Reference in a new issue