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
b0664560
Commit
b0664560
authored
Jul 08, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wscript: Added WScript.Quit tests.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
341bb46f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
24 deletions
+49
-24
run.c
programs/wscript/tests/run.c
+49
-24
No files found.
programs/wscript/tests/run.c
View file @
b0664560
...
...
@@ -339,11 +339,12 @@ static const IClassFactoryVtbl ClassFactoryVtbl = {
static
IClassFactory
testobj_cf
=
{
&
ClassFactoryVtbl
};
static
void
run_
test
(
const
char
*
file_nam
e
)
static
void
run_
script_file
(
const
char
*
file_name
,
DWORD
expected_exit_cod
e
)
{
char
command
[
MAX_PATH
];
STARTUPINFOA
si
=
{
sizeof
(
si
)};
PROCESS_INFORMATION
pi
;
DWORD
exit_code
;
BOOL
bres
;
script_name
=
file_name
;
...
...
@@ -360,37 +361,29 @@ static void run_test(const char *file_name)
wscript_process
=
pi
.
hProcess
;
WaitForSingleObject
(
pi
.
hProcess
,
INFINITE
);
bres
=
GetExitCodeProcess
(
pi
.
hProcess
,
&
exit_code
);
ok
(
bres
,
"GetExitCodeProcess failed: %u
\n
"
,
GetLastError
());
ok
(
exit_code
==
expected_exit_code
,
"exit_code = %u, expected %u
\n
"
,
exit_code
,
expected_exit_code
);
CloseHandle
(
pi
.
hThread
);
CloseHandle
(
pi
.
hProcess
);
CHECK_CALLED
(
reportSuccess
);
}
static
BOOL
WINAPI
test_enum_proc
(
HMODULE
module
,
LPCSTR
type
,
LPSTR
name
,
LONG_PTR
param
)
static
void
run_script
(
const
char
*
name
,
const
char
*
script_data
,
size_t
script_size
,
DWORD
expected_exit_code
)
{
const
char
*
script_data
,
*
ext
;
DWORD
script_size
,
size
;
char
file_name
[
MAX_PATH
];
const
char
*
ext
;
HANDLE
file
;
HRSRC
src
;
DWORD
size
;
BOOL
res
;
trace
(
"running %s test...
\n
"
,
name
);
src
=
FindResourceA
(
NULL
,
name
,
type
);
ok
(
src
!=
NULL
,
"Could not find resource %s: %u
\n
"
,
name
,
GetLastError
());
if
(
!
src
)
return
TRUE
;
script_data
=
LoadResource
(
NULL
,
src
);
script_size
=
SizeofResource
(
NULL
,
src
);
while
(
script_size
&&
!
script_data
[
script_size
-
1
])
script_size
--
;
ext
=
strrchr
(
name
,
'.'
);
ok
(
ext
!=
NULL
,
"no script extension
\n
"
);
if
(
!
ext
)
return
TRUE
;
return
;
sprintf
(
file_name
,
"test%s"
,
ext
);
...
...
@@ -398,17 +391,43 @@ static BOOL WINAPI test_enum_proc(HMODULE module, LPCSTR type, LPSTR name, LONG_
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed: %u
\n
"
,
GetLastError
());
if
(
file
==
INVALID_HANDLE_VALUE
)
return
TRUE
;
return
;
res
=
WriteFile
(
file
,
script_data
,
script_size
,
&
size
,
NULL
);
CloseHandle
(
file
);
ok
(
res
,
"Could not write to file: %u
\n
"
,
GetLastError
());
if
(
!
res
)
return
TRUE
;
return
;
run_
test
(
file_nam
e
);
run_
script_file
(
file_name
,
expected_exit_cod
e
);
DeleteFileA
(
file_name
);
}
static
void
run_simple_script
(
const
char
*
script
,
DWORD
expected_exit_code
)
{
run_script
(
"simple.js"
,
script
,
strlen
(
script
),
expected_exit_code
);
}
static
BOOL
WINAPI
test_enum_proc
(
HMODULE
module
,
LPCSTR
type
,
LPSTR
name
,
LONG_PTR
param
)
{
const
char
*
script_data
;
DWORD
script_size
;
HRSRC
src
;
trace
(
"running %s test...
\n
"
,
name
);
src
=
FindResourceA
(
NULL
,
name
,
type
);
ok
(
src
!=
NULL
,
"Could not find resource %s: %u
\n
"
,
name
,
GetLastError
());
if
(
!
src
)
return
TRUE
;
script_data
=
LoadResource
(
NULL
,
src
);
script_size
=
SizeofResource
(
NULL
,
src
);
while
(
script_size
&&
!
script_data
[
script_size
-
1
])
script_size
--
;
run_script
(
name
,
script_data
,
script_size
,
0
);
return
TRUE
;
}
...
...
@@ -468,11 +487,17 @@ START_TEST(run)
}
argc
=
winetest_get_mainargs
(
&
argv
);
if
(
argc
>
2
)
run_
test
(
argv
[
2
]
);
else
if
(
argc
>
2
)
{
run_
script_file
(
argv
[
2
],
0
);
}
else
{
EnumResourceNamesA
(
NULL
,
"TESTSCRIPT"
,
test_enum_proc
,
0
);
run_simple_script
(
"var winetest = new ActiveXObject('Wine.Test');
\n
"
"winetest.reportSuccess();
\n
"
"WScript.Quit(3);
\n
"
"winetest.ok(false, 'not quit?');
\n
"
,
3
);
}
init_registry
(
FALSE
);
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