Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7cdd5354
Commit
7cdd5354
authored
Jul 03, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added for each loop tests.
parent
44266442
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
222 additions
and
2 deletions
+222
-2
lang.vbs
dlls/vbscript/tests/lang.vbs
+10
-0
run.c
dlls/vbscript/tests/run.c
+212
-2
No files found.
dlls/vbscript/tests/lang.vbs
View file @
7cdd5354
...
@@ -415,6 +415,16 @@ for x = 1 to 100
...
@@ -415,6 +415,16 @@ for x = 1 to 100
Call
ok
(
false
,
"exit for not escaped the loop?"
)
Call
ok
(
false
,
"exit for not escaped the loop?"
)
next
next
Call
collectionObj
.
reset
()
y
=
0
x
=
10
for
each
x
in
collectionObj
y
=
y
+
1
Call
ok
(
x
=
y
,
"x <> y"
)
next
Call
ok
(
y
=
3
,
"y = "
&
y
)
Call
ok
(
getVT
(
x
)
=
"VT_EMPTY*"
,
"getVT(x) = "
&
getVT
(
x
))
if
false
then
if
false
then
Sub
testsub
Sub
testsub
x
=
true
x
=
true
...
...
dlls/vbscript/tests/run.c
View file @
7cdd5354
...
@@ -65,6 +65,8 @@ DEFINE_EXPECT(global_propargput_d);
...
@@ -65,6 +65,8 @@ DEFINE_EXPECT(global_propargput_d);
DEFINE_EXPECT
(
global_propargput_i
);
DEFINE_EXPECT
(
global_propargput_i
);
DEFINE_EXPECT
(
global_propargput1_d
);
DEFINE_EXPECT
(
global_propargput1_d
);
DEFINE_EXPECT
(
global_propargput1_i
);
DEFINE_EXPECT
(
global_propargput1_i
);
DEFINE_EXPECT
(
collectionobj_newenum_i
);
DEFINE_EXPECT
(
Next
);
#define DISPID_GLOBAL_REPORTSUCCESS 1000
#define DISPID_GLOBAL_REPORTSUCCESS 1000
#define DISPID_GLOBAL_TRACE 1001
#define DISPID_GLOBAL_TRACE 1001
...
@@ -79,10 +81,13 @@ DEFINE_EXPECT(global_propargput1_i);
...
@@ -79,10 +81,13 @@ DEFINE_EXPECT(global_propargput1_i);
#define DISPID_GLOBAL_COUNTER 1010
#define DISPID_GLOBAL_COUNTER 1010
#define DISPID_GLOBAL_PROPARGPUT 1011
#define DISPID_GLOBAL_PROPARGPUT 1011
#define DISPID_GLOBAL_PROPARGPUT1 1012
#define DISPID_GLOBAL_PROPARGPUT1 1012
#define DISPID_GLOBAL_COLLOBJ 1013
#define DISPID_TESTOBJ_PROPGET 2000
#define DISPID_TESTOBJ_PROPGET 2000
#define DISPID_TESTOBJ_PROPPUT 2001
#define DISPID_TESTOBJ_PROPPUT 2001
#define DISPID_COLLOBJ_RESET 3000
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
BOOL
strict_dispid_check
;
static
BOOL
strict_dispid_check
;
...
@@ -337,6 +342,96 @@ static void _test_grfdex(unsigned line, DWORD grfdex, DWORD expect)
...
@@ -337,6 +342,96 @@ static void _test_grfdex(unsigned line, DWORD grfdex, DWORD expect)
ok_
(
__FILE__
,
line
)(
grfdex
==
expect
,
"grfdex = %x, expected %x
\n
"
,
grfdex
,
expect
);
ok_
(
__FILE__
,
line
)(
grfdex
==
expect
,
"grfdex = %x, expected %x
\n
"
,
grfdex
,
expect
);
}
}
static
const
char
*
debugstr_guid
(
REFIID
riid
)
{
static
char
buf
[
50
];
sprintf
(
buf
,
"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"
,
riid
->
Data1
,
riid
->
Data2
,
riid
->
Data3
,
riid
->
Data4
[
0
],
riid
->
Data4
[
1
],
riid
->
Data4
[
2
],
riid
->
Data4
[
3
],
riid
->
Data4
[
4
],
riid
->
Data4
[
5
],
riid
->
Data4
[
6
],
riid
->
Data4
[
7
]);
return
buf
;
}
static
IDispatchEx
enumDisp
;
static
HRESULT
WINAPI
EnumVARIANT_QueryInterface
(
IEnumVARIANT
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
riid
,
&
IID_IEnumVARIANT
))
{
*
ppv
=
iface
;
return
S_OK
;
}
if
(
IsEqualGUID
(
riid
,
&
IID_IDispatch
))
{
*
ppv
=
&
enumDisp
;
return
S_OK
;
}
ok
(
0
,
"unexpected call %s
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
EnumVARIANT_AddRef
(
IEnumVARIANT
*
iface
)
{
return
2
;
}
static
ULONG
WINAPI
EnumVARIANT_Release
(
IEnumVARIANT
*
iface
)
{
return
1
;
}
static
unsigned
next_cnt
;
static
HRESULT
WINAPI
EnumVARIANT_Next
(
IEnumVARIANT
*
iface
,
ULONG
celt
,
VARIANT
*
rgVar
,
ULONG
*
pCeltFetched
)
{
if
(
strict_dispid_check
)
CHECK_EXPECT2
(
Next
);
ok
(
celt
==
1
,
"celt = %d
\n
"
,
celt
);
ok
(
V_VT
(
rgVar
)
==
VT_EMPTY
,
"V_VT(rgVar) = %d
\n
"
,
V_VT
(
rgVar
));
ok
(
!
pCeltFetched
,
"pCeltFetched = %p
\n
"
,
pCeltFetched
);
if
(
next_cnt
++
<
3
)
{
V_VT
(
rgVar
)
=
VT_I2
;
V_I2
(
rgVar
)
=
next_cnt
;
return
S_OK
;
}
return
S_FALSE
;
}
static
HRESULT
WINAPI
EnumVARIANT_Skip
(
IEnumVARIANT
*
iface
,
ULONG
celt
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
EnumVARIANT_Reset
(
IEnumVARIANT
*
iface
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
EnumVARIANT_Clone
(
IEnumVARIANT
*
iface
,
IEnumVARIANT
**
ppEnum
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
const
IEnumVARIANTVtbl
EnumVARIANTVtbl
=
{
EnumVARIANT_QueryInterface
,
EnumVARIANT_AddRef
,
EnumVARIANT_Release
,
EnumVARIANT_Next
,
EnumVARIANT_Skip
,
EnumVARIANT_Reset
,
EnumVARIANT_Clone
};
static
IEnumVARIANT
enumObj
=
{
&
EnumVARIANTVtbl
};
static
HRESULT
WINAPI
DispatchEx_QueryInterface
(
IDispatchEx
*
iface
,
REFIID
riid
,
void
**
ppv
)
static
HRESULT
WINAPI
DispatchEx_QueryInterface
(
IDispatchEx
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
{
*
ppv
=
NULL
;
*
ppv
=
NULL
;
...
@@ -345,8 +440,10 @@ static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid,
...
@@ -345,8 +440,10 @@ static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid,
||
IsEqualGUID
(
riid
,
&
IID_IDispatch
)
||
IsEqualGUID
(
riid
,
&
IID_IDispatch
)
||
IsEqualGUID
(
riid
,
&
IID_IDispatchEx
))
||
IsEqualGUID
(
riid
,
&
IID_IDispatchEx
))
*
ppv
=
iface
;
*
ppv
=
iface
;
else
else
{
trace
(
"QI %s
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
return
E_NOINTERFACE
;
}
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
return
S_OK
;
return
S_OK
;
...
@@ -436,7 +533,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
...
@@ -436,7 +533,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
static
HRESULT
WINAPI
DispatchEx_InvokeEx
(
IDispatchEx
*
iface
,
DISPID
id
,
LCID
lcid
,
WORD
wFlags
,
DISPPARAMS
*
pdp
,
static
HRESULT
WINAPI
DispatchEx_InvokeEx
(
IDispatchEx
*
iface
,
DISPID
id
,
LCID
lcid
,
WORD
wFlags
,
DISPPARAMS
*
pdp
,
VARIANT
*
pvarRes
,
EXCEPINFO
*
pei
,
IServiceProvider
*
pspCaller
)
VARIANT
*
pvarRes
,
EXCEPINFO
*
pei
,
IServiceProvider
*
pspCaller
)
{
{
ok
(
0
,
"unexpected call
\n
"
);
ok
(
0
,
"unexpected call
%d
\n
"
,
id
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
...
@@ -520,6 +617,91 @@ static IDispatchExVtbl testObjVtbl = {
...
@@ -520,6 +617,91 @@ static IDispatchExVtbl testObjVtbl = {
static
IDispatchEx
testObj
=
{
&
testObjVtbl
};
static
IDispatchEx
testObj
=
{
&
testObjVtbl
};
static
HRESULT
WINAPI
enumDisp_QueryInterface
(
IDispatchEx
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
return
IEnumVARIANT_QueryInterface
(
&
enumObj
,
riid
,
ppv
);
}
static
IDispatchExVtbl
enumDispVtbl
=
{
enumDisp_QueryInterface
,
DispatchEx_AddRef
,
DispatchEx_Release
,
DispatchEx_GetTypeInfoCount
,
DispatchEx_GetTypeInfo
,
DispatchEx_GetIDsOfNames
,
DispatchEx_Invoke
,
DispatchEx_GetDispID
,
DispatchEx_InvokeEx
,
DispatchEx_DeleteMemberByName
,
DispatchEx_DeleteMemberByDispID
,
DispatchEx_GetMemberProperties
,
DispatchEx_GetMemberName
,
DispatchEx_GetNextDispID
,
DispatchEx_GetNameSpaceParent
};
static
IDispatchEx
enumDisp
=
{
&
enumDispVtbl
};
static
HRESULT
WINAPI
collectionObj_GetDispID
(
IDispatchEx
*
iface
,
BSTR
bstrName
,
DWORD
grfdex
,
DISPID
*
pid
)
{
if
(
!
strcmp_wa
(
bstrName
,
"reset"
))
{
*
pid
=
DISPID_COLLOBJ_RESET
;
return
S_OK
;
}
ok
(
0
,
"unexpected call %s
\n
"
,
wine_dbgstr_w
(
bstrName
));
return
DISP_E_UNKNOWNNAME
;
}
static
HRESULT
WINAPI
collectionObj_InvokeEx
(
IDispatchEx
*
iface
,
DISPID
id
,
LCID
lcid
,
WORD
wFlags
,
DISPPARAMS
*
pdp
,
VARIANT
*
pvarRes
,
EXCEPINFO
*
pei
,
IServiceProvider
*
pspCaller
)
{
switch
(
id
)
{
case
DISPID_NEWENUM
:
if
(
strict_dispid_check
)
CHECK_EXPECT
(
collectionobj_newenum_i
);
ok
(
wFlags
==
(
DISPATCH_PROPERTYGET
|
DISPATCH_METHOD
),
"wFlags = %x
\n
"
,
wFlags
);
ok
(
pdp
!=
NULL
,
"pdp == NULL
\n
"
);
ok
(
!
pdp
->
rgvarg
,
"rgvarg == NULL
\n
"
);
ok
(
!
pdp
->
rgdispidNamedArgs
,
"rgdispidNamedArgs != NULL
\n
"
);
ok
(
!
pdp
->
cArgs
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
ok
(
!
pdp
->
cNamedArgs
,
"cNamedArgs = %d
\n
"
,
pdp
->
cNamedArgs
);
ok
(
pvarRes
!=
NULL
,
"pvarRes == NULL
\n
"
);
ok
(
pei
!=
NULL
,
"pei == NULL
\n
"
);
V_VT
(
pvarRes
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
pvarRes
)
=
(
IUnknown
*
)
&
enumObj
;
return
S_OK
;
case
DISPID_COLLOBJ_RESET
:
next_cnt
=
0
;
return
S_OK
;
}
ok
(
0
,
"unexpected call %d
\n
"
,
id
);
return
E_NOTIMPL
;
}
static
IDispatchExVtbl
collectionObjVtbl
=
{
DispatchEx_QueryInterface
,
DispatchEx_AddRef
,
DispatchEx_Release
,
DispatchEx_GetTypeInfoCount
,
DispatchEx_GetTypeInfo
,
DispatchEx_GetIDsOfNames
,
DispatchEx_Invoke
,
collectionObj_GetDispID
,
collectionObj_InvokeEx
,
DispatchEx_DeleteMemberByName
,
DispatchEx_DeleteMemberByDispID
,
DispatchEx_GetMemberProperties
,
DispatchEx_GetMemberName
,
DispatchEx_GetNextDispID
,
DispatchEx_GetNameSpaceParent
};
static
IDispatchEx
collectionObj
=
{
&
collectionObjVtbl
};
static
ULONG
refobj_ref
;
static
ULONG
refobj_ref
;
static
ULONG
WINAPI
RefObj_AddRef
(
IDispatchEx
*
iface
)
static
ULONG
WINAPI
RefObj_AddRef
(
IDispatchEx
*
iface
)
...
@@ -585,6 +767,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
...
@@ -585,6 +767,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
*
pid
=
DISPID_GLOBAL_TESTOBJ
;
*
pid
=
DISPID_GLOBAL_TESTOBJ
;
return
S_OK
;
return
S_OK
;
}
}
if
(
!
strcmp_wa
(
bstrName
,
"collectionObj"
))
{
test_grfdex
(
grfdex
,
fdexNameCaseInsensitive
);
*
pid
=
DISPID_GLOBAL_COLLOBJ
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"vbvar"
))
{
if
(
!
strcmp_wa
(
bstrName
,
"vbvar"
))
{
CHECK_EXPECT
(
global_vbvar_d
);
CHECK_EXPECT
(
global_vbvar_d
);
test_grfdex
(
grfdex
,
fdexNameCaseInsensitive
);
test_grfdex
(
grfdex
,
fdexNameCaseInsensitive
);
...
@@ -753,6 +940,21 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
...
@@ -753,6 +940,21 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
V_DISPATCH
(
pvarRes
)
=
(
IDispatch
*
)
&
testObj
;
V_DISPATCH
(
pvarRes
)
=
(
IDispatch
*
)
&
testObj
;
return
S_OK
;
return
S_OK
;
case
DISPID_GLOBAL_COLLOBJ
:
ok
(
wFlags
==
(
DISPATCH_PROPERTYGET
|
DISPATCH_METHOD
),
"wFlags = %x
\n
"
,
wFlags
);
ok
(
pdp
!=
NULL
,
"pdp == NULL
\n
"
);
ok
(
!
pdp
->
rgvarg
,
"rgvarg != NULL
\n
"
);
ok
(
!
pdp
->
rgdispidNamedArgs
,
"rgdispidNamedArgs != NULL
\n
"
);
ok
(
!
pdp
->
cArgs
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
ok
(
!
pdp
->
cNamedArgs
,
"cNamedArgs = %d
\n
"
,
pdp
->
cNamedArgs
);
ok
(
pvarRes
!=
NULL
,
"pvarRes == NULL
\n
"
);
ok
(
pei
!=
NULL
,
"pei == NULL
\n
"
);
V_VT
(
pvarRes
)
=
VT_DISPATCH
;
V_DISPATCH
(
pvarRes
)
=
(
IDispatch
*
)
&
collectionObj
;
return
S_OK
;
case
DISPID_GLOBAL_REFOBJ
:
case
DISPID_GLOBAL_REFOBJ
:
ok
(
wFlags
==
(
DISPATCH_PROPERTYGET
|
DISPATCH_METHOD
),
"wFlags = %x
\n
"
,
wFlags
);
ok
(
wFlags
==
(
DISPATCH_PROPERTYGET
|
DISPATCH_METHOD
),
"wFlags = %x
\n
"
,
wFlags
);
...
@@ -1336,6 +1538,14 @@ static void run_tests(void)
...
@@ -1336,6 +1538,14 @@ static void run_tests(void)
CHECK_CALLED
(
global_propargput1_d
);
CHECK_CALLED
(
global_propargput1_d
);
CHECK_CALLED
(
global_propargput1_i
);
CHECK_CALLED
(
global_propargput1_i
);
next_cnt
=
0
;
SET_EXPECT
(
collectionobj_newenum_i
);
SET_EXPECT
(
Next
);
parse_script_a
(
"for each x in collectionObj
\n
next"
);
CHECK_CALLED
(
collectionobj_newenum_i
);
CHECK_CALLED
(
Next
);
ok
(
next_cnt
==
4
,
"next_cnt = %d
\n
"
,
next_cnt
);
parse_script_a
(
"x = 1
\n
Call ok(x = 1,
\"
x =
\"
& x)"
);
parse_script_a
(
"x = 1
\n
Call ok(x = 1,
\"
x =
\"
& x)"
);
parse_script_a
(
"x = _
\n
3"
);
parse_script_a
(
"x = _
\n
3"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment