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
fded8dc0
Commit
fded8dc0
authored
Oct 19, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 20, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added invoke version 2 tests.
parent
86e7beae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
27 deletions
+132
-27
api.js
dlls/jscript/tests/api.js
+42
-12
run.c
dlls/jscript/tests/run.c
+90
-15
No files found.
dlls/jscript/tests/api.js
View file @
fded8dc0
...
...
@@ -667,7 +667,7 @@ ok(arr === arr.valueOf(), "arr !== arr.valueOf");
arr
=
[
1
,
2
,
3
];
tmp
=
arr
.
unshift
(
0
);
ok
(
tmp
===
undefined
,
"[1,2,3].unshift(0) returned "
+
tmp
);
ok
(
tmp
===
(
invokeVersion
<
2
?
undefined
:
4
)
,
"[1,2,3].unshift(0) returned "
+
tmp
);
ok
(
arr
.
length
===
4
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
.
toString
()
===
"0,1,2,3"
,
"arr.toString() = "
+
arr
.
toString
());
...
...
@@ -675,13 +675,13 @@ arr = new Array(3);
arr
[
0
]
=
1
;
arr
[
2
]
=
3
;
tmp
=
arr
.
unshift
(
-
1
,
0
);
ok
(
tmp
===
undefined
,
"unshift returned "
+
tmp
);
ok
(
tmp
===
(
invokeVersion
<
2
?
undefined
:
5
)
,
"unshift returned "
+
tmp
);
ok
(
arr
.
length
===
5
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
.
toString
()
===
"-1,0,1,,3"
,
"arr.toString() = "
+
arr
.
toString
());
arr
=
[
1
,
2
,
3
];
tmp
=
arr
.
unshift
();
ok
(
tmp
===
undefined
,
"unshift returned "
+
tmp
);
ok
(
tmp
===
(
invokeVersion
<
2
?
undefined
:
3
)
,
"unshift returned "
+
tmp
);
ok
(
arr
.
length
===
3
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
.
toString
()
===
"1,2,3"
,
"arr.toString() = "
+
arr
.
toString
());
...
...
@@ -690,7 +690,7 @@ arr.length = 2;
arr
[
0
]
=
1
;
arr
[
1
]
=
2
;
tmp
=
Array
.
prototype
.
unshift
.
call
(
arr
,
0
);
ok
(
tmp
===
undefined
,
"unshift returned "
+
tmp
);
ok
(
tmp
===
(
invokeVersion
<
2
?
undefined
:
3
)
,
"unshift returned "
+
tmp
);
ok
(
arr
.
length
===
3
,
"arr.length = "
+
arr
.
length
);
ok
(
arr
[
0
]
===
0
&&
arr
[
1
]
===
1
&&
arr
[
2
]
===
2
,
"unexpected array"
);
...
...
@@ -1587,7 +1587,7 @@ ok(Error.prototype.name === "Error", "Error.prototype.name = " + Error.prototype
ok
(
err
.
name
===
"Error"
,
"err.name = "
+
err
.
name
);
EvalError
.
prototype
.
message
=
"test"
;
ok
(
err
.
toString
!==
Object
.
prototype
.
toString
,
"err.toString === Object.prototype.toString"
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"Error"
)
,
"err.toString() = "
+
err
.
toString
());
err
=
new
EvalError
();
ok
(
EvalError
.
prototype
.
name
===
"EvalError"
,
"EvalError.prototype.name = "
+
EvalError
.
prototype
.
name
);
ok
(
err
.
name
===
"EvalError"
,
"err.name = "
+
err
.
name
);
...
...
@@ -1595,31 +1595,32 @@ ok(err.toString === Error.prototype.toString, "err.toString !== Error.prototype.
ok
(
err
.
message
===
""
,
"err.message != ''"
);
err
.
message
=
date
;
ok
(
err
.
message
===
date
,
"err.message != date"
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"EvalError: Fri Aug 17 22:50:50 UTC+0200 85"
),
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
!==
Object
.
prototype
.
toString
,
"err.toString === Object.prototype.toString"
);
err
=
new
RangeError
();
ok
(
RangeError
.
prototype
.
name
===
"RangeError"
,
"RangeError.prototype.name = "
+
RangeError
.
prototype
.
name
);
ok
(
err
.
name
===
"RangeError"
,
"err.name = "
+
err
.
name
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"RangeError"
)
,
"err.toString() = "
+
err
.
toString
());
err
=
new
ReferenceError
();
ok
(
ReferenceError
.
prototype
.
name
===
"ReferenceError"
,
"ReferenceError.prototype.name = "
+
ReferenceError
.
prototype
.
name
);
ok
(
err
.
name
===
"ReferenceError"
,
"err.name = "
+
err
.
name
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"ReferenceError"
)
,
"err.toString() = "
+
err
.
toString
());
err
=
new
SyntaxError
();
ok
(
SyntaxError
.
prototype
.
name
===
"SyntaxError"
,
"SyntaxError.prototype.name = "
+
SyntaxError
.
prototype
.
name
);
ok
(
err
.
name
===
"SyntaxError"
,
"err.name = "
+
err
.
name
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"SyntaxError"
)
,
"err.toString() = "
+
err
.
toString
());
err
=
new
TypeError
();
ok
(
TypeError
.
prototype
.
name
===
"TypeError"
,
"TypeError.prototype.name = "
+
TypeError
.
prototype
.
name
);
ok
(
err
.
name
===
"TypeError"
,
"err.name = "
+
err
.
name
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"TypeError"
)
,
"err.toString() = "
+
err
.
toString
());
err
=
new
URIError
();
ok
(
URIError
.
prototype
.
name
===
"URIError"
,
"URIError.prototype.name = "
+
URIError
.
prototype
.
name
);
ok
(
err
.
name
===
"URIError"
,
"err.name = "
+
err
.
name
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"URIError"
)
,
"err.toString() = "
+
err
.
toString
());
err
=
new
Error
(
"message"
);
ok
(
err
.
message
===
"message"
,
"err.message !== 'message'"
);
ok
(
err
.
toString
()
===
"[object Error]"
,
"err.toString() = "
+
err
.
toString
());
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"Error: message"
)
,
"err.toString() = "
+
err
.
toString
());
err
=
new
Error
(
123
);
ok
(
err
.
number
===
123
,
"err.number = "
+
err
.
number
);
err
=
new
Error
(
0
,
"message"
);
...
...
@@ -1627,6 +1628,35 @@ ok(err.number === 0, "err.number = " + err.number);
ok
(
err
.
message
===
"message"
,
"err.message = "
+
err
.
message
);
ok
(
err
.
description
===
"message"
,
"err.description = "
+
err
.
description
);
tmp
=
new
Object
();
tmp
.
toString
=
function
()
{
return
"test"
;
};
tmp
=
Error
.
prototype
.
toString
.
call
(
tmp
);
ok
(
tmp
===
"[object Error]"
,
"Error.prototype.toString.call(tmp) = "
+
tmp
);
err
=
new
Error
();
err
.
name
=
null
;
ok
(
err
.
name
===
null
,
"err.name = "
+
err
.
name
+
" expected null"
);
if
(
invokeVersion
>=
2
)
ok
(
err
.
toString
()
===
"null"
,
"err.toString() = "
+
err
.
toString
());
err
=
new
Error
();
err
.
message
=
false
;
ok
(
err
.
message
===
false
,
"err.message = "
+
err
.
message
+
" expected false"
);
if
(
invokeVersion
>=
2
)
ok
(
err
.
toString
()
===
"Error: false"
,
"err.toString() = "
+
err
.
toString
());
err
=
new
Error
();
err
.
message
=
new
Object
();
err
.
message
.
toString
=
function
()
{
return
""
;
};
if
(
invokeVersion
>=
2
)
ok
(
err
.
toString
()
===
"Error"
,
"err.toString() = "
+
err
.
toString
());
err
=
new
Error
();
err
.
message
=
undefined
;
if
(
invokeVersion
>=
2
)
ok
(
err
.
toString
()
===
"Error"
,
"err.toString() = "
+
err
.
toString
());
function
exception_test
(
func
,
type
,
number
)
{
ret
=
""
;
num
=
""
;
...
...
dlls/jscript/tests/run.c
View file @
fded8dc0
...
...
@@ -81,6 +81,7 @@ DEFINE_EXPECT(GetItemInfo_testVal);
#define DISPID_GLOBAL_NULL_DISP 0x1008
#define DISPID_GLOBAL_TESTTHIS 0x1009
#define DISPID_GLOBAL_TESTTHIS2 0x100a
#define DISPID_GLOBAL_INVOKEVERSION 0x100b
#define DISPID_TESTOBJ_PROP 0x2000
...
...
@@ -92,6 +93,7 @@ static const CHAR test_valA[] = "testVal";
static
BOOL
strict_dispid_check
;
static
const
char
*
test_name
=
"(null)"
;
static
IDispatch
*
script_disp
;
static
int
invoke_version
;
static
BSTR
a2bstr
(
const
char
*
str
)
{
...
...
@@ -112,6 +114,13 @@ static int strcmp_wa(LPCWSTR strw, const char *stra)
return
lstrcmpA
(
buf
,
stra
);
}
#define test_grfdex(a,b) _test_grfdex(__LINE__,a,b)
static
void
_test_grfdex
(
unsigned
line
,
DWORD
grfdex
,
DWORD
expect
)
{
expect
|=
invoke_version
<<
28
;
ok_
(
__FILE__
,
line
)(
grfdex
==
expect
,
"grfdex = %x, expected %x
\n
"
,
grfdex
,
expect
);
}
static
HRESULT
WINAPI
DispatchEx_QueryInterface
(
IDispatchEx
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
*
ppv
=
NULL
;
...
...
@@ -205,13 +214,13 @@ static HRESULT WINAPI testObj_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
{
if
(
!
strcmp_wa
(
bstrName
,
"prop"
))
{
CHECK_EXPECT
(
testobj_prop_d
);
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_TESTOBJ_PROP
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"noprop"
))
{
CHECK_EXPECT
(
testobj_noprop_d
);
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
return
DISP_E_UNKNOWNNAME
;
}
...
...
@@ -250,7 +259,7 @@ static HRESULT WINAPI testObj_DeleteMemberByName(IDispatchEx *iface, BSTR bstrNa
CHECK_EXPECT
(
testobj_delete
);
ok
(
!
strcmp_wa
(
bstrName
,
"deleteTest"
),
"unexpected name %s
\n
"
,
wine_dbgstr_w
(
bstrName
));
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
return
S_OK
;
}
...
...
@@ -277,40 +286,40 @@ static IDispatchEx testObj = { &testObjVtbl };
static
HRESULT
WINAPI
Global_GetDispID
(
IDispatchEx
*
iface
,
BSTR
bstrName
,
DWORD
grfdex
,
DISPID
*
pid
)
{
if
(
!
strcmp_wa
(
bstrName
,
"ok"
))
{
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_OK
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"trace"
))
{
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_TRACE
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"reportSuccess"
))
{
CHECK_EXPECT
(
global_success_d
);
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_REPORTSUCCESS
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"testPropGet"
))
{
CHECK_EXPECT
(
global_propget_d
);
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_TESTPROPGET
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"testPropPut"
))
{
CHECK_EXPECT
(
global_propput_d
);
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_TESTPROPPUT
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"getVT"
))
{
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_GETVT
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"testObj"
))
{
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_TESTOBJ
;
return
S_OK
;
}
...
...
@@ -324,22 +333,28 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
}
if
(
!
strcmp_wa
(
bstrName
,
"notExists"
))
{
CHECK_EXPECT
(
global_notexists_d
);
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
return
DISP_E_UNKNOWNNAME
;
}
if
(
!
strcmp_wa
(
bstrName
,
"testThis"
))
{
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_TESTTHIS
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"testThis2"
))
{
ok
(
grfdex
==
fdexNameCaseSensitive
,
"grfdex = %x
\n
"
,
grfdex
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_TESTTHIS2
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"invokeVersion"
))
{
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_INVOKEVERSION
;
return
S_OK
;
}
if
(
strict_dispid_check
)
ok
(
0
,
"unexpected call %s
\n
"
,
wine_dbgstr_w
(
bstrName
));
return
DISP_E_UNKNOWNNAME
;
...
...
@@ -536,6 +551,23 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
ok
(
V_DISPATCH
(
pdp
->
rgvarg
)
==
script_disp
,
"disp != script_disp
\n
"
);
return
S_OK
;
case
DISPID_GLOBAL_INVOKEVERSION
:
ok
(
wFlags
==
INVOKE_PROPERTYGET
,
"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
(
V_VT
(
pvarRes
)
==
VT_EMPTY
,
"V_VT(pvarRes) = %d
\n
"
,
V_VT
(
pvarRes
));
ok
(
pei
!=
NULL
,
"pei == NULL
\n
"
);
V_VT
(
pvarRes
)
=
VT_I4
;
V_I4
(
pvarRes
)
=
invoke_version
;
return
S_OK
;
}
ok
(
0
,
"unexpected call %x
\n
"
,
id
);
...
...
@@ -657,15 +689,40 @@ static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl = {
static
IActiveScriptSite
ActiveScriptSite
=
{
&
ActiveScriptSiteVtbl
};
static
HRESULT
set_script_prop
(
IActiveScript
*
engine
,
DWORD
property
,
VARIANT
*
val
)
{
IActiveScriptProperty
*
script_prop
;
HRESULT
hres
;
hres
=
IActiveScript_QueryInterface
(
engine
,
&
IID_IActiveScriptProperty
,
(
void
**
)
&
script_prop
);
ok
(
hres
==
S_OK
,
"Could not get IActiveScriptProperty iface: %08x
\n
"
,
hres
);
hres
=
IActiveScriptProperty_SetProperty
(
script_prop
,
property
,
NULL
,
val
);
IActiveScriptProperty_Release
(
script_prop
);
return
hres
;
}
static
IActiveScript
*
create_script
(
void
)
{
IActiveScript
*
script
;
VARIANT
v
;
HRESULT
hres
;
hres
=
CoCreateInstance
(
&
CLSID_JScript
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IActiveScript
,
(
void
**
)
&
script
);
ok
(
hres
==
S_OK
,
"CoCreateInstance failed: %08x
\n
"
,
hres
);
V_VT
(
&
v
)
=
VT_I4
;
V_I4
(
&
v
)
=
invoke_version
;
hres
=
set_script_prop
(
script
,
SCRIPTPROP_INVOKEVERSIONING
,
&
v
);
ok
(
hres
==
S_OK
||
broken
(
hres
==
E_NOTIMPL
),
"SetProperty(SCRIPTPROP_INVOKEVERSIONING) failed: %08x
\n
"
,
hres
);
if
(
invoke_version
&&
FAILED
(
hres
))
{
IActiveScript_Release
(
script
);
return
NULL
;
}
return
script
;
}
...
...
@@ -912,6 +969,17 @@ static void run_tests(void)
{
HRESULT
hres
;
if
(
invoke_version
)
{
IActiveScript
*
script
;
script
=
create_script
();
if
(
!
script
)
{
win_skip
(
"Could not create script
\n
"
);
return
;
}
IActiveScript_Release
(
script
);
}
strict_dispid_check
=
TRUE
;
parse_script_a
(
""
);
...
...
@@ -1019,10 +1087,17 @@ START_TEST(run)
CoInitialize
(
NULL
);
if
(
argc
>
2
)
if
(
argc
>
2
)
{
run_from_file
(
argv
[
2
]);
else
}
else
{
trace
(
"invoke version 0
\n
"
);
invoke_version
=
0
;
run_tests
();
trace
(
"invoke version 2
\n
"
);
invoke_version
=
2
;
run_tests
();
}
CoUninitialize
();
}
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