Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e4da2c59
Commit
e4da2c59
authored
Aug 08, 2016
by
Hugh McMaster
Committed by
Alexandre Julliard
Aug 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg/tests: Add more tests for 'reg import'.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
978ee87a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
157 additions
and
0 deletions
+157
-0
reg.c
programs/reg/tests/reg.c
+157
-0
No files found.
programs/reg/tests/reg.c
View file @
e4da2c59
...
...
@@ -699,6 +699,66 @@ static BOOL write_reg_file(const char *value, char *tmp_name)
return
ret
;
}
#define test_import_str(c,r) test_import_str_(__LINE__,c,r)
static
BOOL
test_import_str_
(
unsigned
line
,
const
char
*
file_contents
,
DWORD
*
rc
)
{
HANDLE
regfile
;
DWORD
written
;
BOOL
ret
;
regfile
=
CreateFileA
(
"test.reg"
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
lok
(
regfile
!=
INVALID_HANDLE_VALUE
,
"Failed to create test.reg file
\n
"
);
if
(
regfile
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
ret
=
WriteFile
(
regfile
,
file_contents
,
strlen
(
file_contents
),
&
written
,
NULL
);
lok
(
ret
,
"WriteFile failed: %u
\n
"
,
GetLastError
());
CloseHandle
(
regfile
);
run_reg_exe
(
"reg import test.reg"
,
rc
);
ret
=
DeleteFileA
(
"test.reg"
);
lok
(
ret
,
"DeleteFile failed: %u
\n
"
,
GetLastError
());
return
ret
;
}
#define test_import_wstr(c,r) test_import_wstr_(__LINE__,c,r)
static
BOOL
test_import_wstr_
(
unsigned
line
,
const
char
*
file_contents
,
DWORD
*
rc
)
{
int
len
,
memsize
;
WCHAR
*
wstr
;
HANDLE
regfile
;
DWORD
written
;
BOOL
ret
;
len
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
file_contents
,
-
1
,
NULL
,
0
);
memsize
=
len
*
sizeof
(
WCHAR
);
wstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
memsize
);
if
(
!
wstr
)
return
FALSE
;
MultiByteToWideChar
(
CP_UTF8
,
0
,
file_contents
,
-
1
,
wstr
,
memsize
);
regfile
=
CreateFileA
(
"test.reg"
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
lok
(
regfile
!=
INVALID_HANDLE_VALUE
,
"Failed to create test.reg file
\n
"
);
if
(
regfile
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
ret
=
WriteFile
(
regfile
,
wstr
,
memsize
,
&
written
,
NULL
);
lok
(
ret
,
"WriteFile failed: %u
\n
"
,
GetLastError
());
CloseHandle
(
regfile
);
HeapFree
(
GetProcessHeap
(),
0
,
wstr
);
run_reg_exe
(
"reg import test.reg"
,
rc
);
ret
=
DeleteFileA
(
"test.reg"
);
lok
(
ret
,
"DeleteFile failed: %u
\n
"
,
GetLastError
());
return
ret
;
}
static
void
test_import
(
void
)
{
DWORD
r
,
dword
=
0x123
;
...
...
@@ -747,6 +807,103 @@ static void test_import(void)
DeleteFileA
(
test1_reg
);
DeleteFileA
(
test2_reg
);
/* Test file contents */
test_import_str
(
"regedit
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_str
(
"regedit4
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_str
(
"REGEDIT
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
"REGEDIT4
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
" REGEDIT4
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
"
\t
REGEDIT4
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
"
\n
REGEDIT4
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_str
(
"AREGEDIT4
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_str
(
"1REGEDIT4
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_str
(
"REGEDIT3
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
"REGEDIT5
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
"REGEDIT9
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
"REGEDIT 4
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
"REGEDIT4 FOO
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_str
(
"Windows Registry Editor Version 4.00
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_str
(
"Windows Registry Editor Version 5.00
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
/* Test file contents - Unicode */
test_import_wstr
(
"Windows Registry Editor Version 4.00
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_wstr
(
"Windows Registry Editor Version 5.00
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_wstr
(
"\uFEFFWindows Registry Editor Version 5
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_wstr
(
"\uFEFFWindows Registry Editor Version 5.00
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_wstr
(
"\uFEFFWINDOWS Registry Editor Version 5.00
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_wstr
(
" \uFEFFWindows Registry Editor Version 5.00
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_wstr
(
"
\t
\uFEFFWindows Registry Editor Version 5.00
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_wstr
(
"
\n
\uFEFFWindows Registry Editor Version 5.00
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
test_import_wstr
(
"\uFEFF Windows Registry Editor Version 5.00
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_wstr
(
"\uFEFF
\t
Windows Registry Editor Version 5.00
\n
"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
test_import_wstr
(
"\uFEFF
\n
Windows Registry Editor Version 5.00
\n
"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
||
broken
(
r
==
REG_EXIT_SUCCESS
)
/* WinXP */
,
"got exit code %d, expected 1
\n
"
,
r
);
}
START_TEST
(
reg
)
...
...
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