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
247e611d
Commit
247e611d
authored
Jun 08, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Jun 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit/tests: Add tests for key creation and key deletion.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
80d248c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
0 deletions
+104
-0
regedit.c
programs/regedit/tests/regedit.c
+104
-0
No files found.
programs/regedit/tests/regedit.c
View file @
247e611d
...
...
@@ -163,6 +163,33 @@ static void r_verify_reg_nonexist(unsigned line, HKEY key, const char *value_nam
value_name
);
}
#define verify_key_exist(k,s) verify_key_exist_(__LINE__,k,s)
static
void
verify_key_exist_
(
unsigned
line
,
HKEY
key_base
,
const
char
*
subkey
)
{
HKEY
hkey
;
LONG
lr
;
lr
=
RegOpenKeyExA
(
key_base
,
subkey
,
0
,
KEY_READ
,
&
hkey
);
lok
(
lr
==
ERROR_SUCCESS
,
"RegOpenKeyExA failed: got %d
\n
"
,
lr
);
if
(
hkey
)
RegCloseKey
(
hkey
);
}
#define verify_key_nonexist(k,s) verify_key_nonexist_(__LINE__,k,s)
static
void
verify_key_nonexist_
(
unsigned
line
,
HKEY
key_base
,
const
char
*
subkey
)
{
HKEY
hkey
;
LONG
lr
;
lr
=
RegOpenKeyExA
(
key_base
,
subkey
,
0
,
KEY_READ
,
&
hkey
);
lok
(
lr
==
ERROR_FILE_NOT_FOUND
,
"registry key '%s' shouldn't exist; got %d, expected 2
\n
"
,
subkey
,
lr
);
if
(
hkey
)
RegCloseKey
(
hkey
);
}
#define KEY_BASE "Software\\Wine\\regedit_test"
static
void
test_basic_import
(
void
)
...
...
@@ -1110,6 +1137,82 @@ static void test_import_with_whitespace(void)
ok
(
lr
==
ERROR_SUCCESS
,
"RegDeleteKeyA failed: got %d, expected 0
\n
"
,
lr
);
}
static
void
test_key_creation_and_deletion
(
void
)
{
HKEY
hkey
;
LONG
lr
;
exec_import_str
(
"REGEDIT4
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\n\n
"
);
lr
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
KEY_BASE
,
0
,
KEY_READ
,
&
hkey
);
ok
(
lr
==
ERROR_SUCCESS
,
"RegOpenKeyExA failed: got %d, expected 0
\n
"
,
lr
);
/* Test key creation */
exec_import_str
(
"REGEDIT4
\n\n
"
"HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
No_Opening_Bracket]
\n
"
);
verify_key_nonexist
(
hkey
,
"No_Opening_Bracket"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
No_Closing_Bracket
\n
"
);
todo_wine
verify_key_nonexist
(
hkey
,
"No_Closing_Bracket"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[ HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey1a]
\n
"
);
verify_key_nonexist
(
hkey
,
"Subkey1a"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[
\t
HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey1b]
\n
"
);
verify_key_nonexist
(
hkey
,
"Subkey1b"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey1c ]
\n
"
);
verify_key_exist
(
hkey
,
"Subkey1c "
);
lr
=
RegDeleteKeyA
(
hkey
,
"Subkey1c "
);
ok
(
lr
==
ERROR_SUCCESS
,
"got %d, expected 0
\n
"
,
lr
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey1d
\t
]
\n
"
);
verify_key_exist
(
hkey
,
"Subkey1d
\t
"
);
lr
=
RegDeleteKeyA
(
hkey
,
"Subkey1d
\t
"
);
ok
(
lr
==
ERROR_SUCCESS
,
"got %d, expected 0
\n
"
,
lr
);
/* Test key deletion. We start by creating some registry keys. */
exec_import_str
(
"REGEDIT4
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey2a]
\n\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey2b]
\n\n
"
);
verify_key_exist
(
hkey
,
"Subkey2a"
);
verify_key_exist
(
hkey
,
"Subkey2b"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[ -HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey2a]
\n
"
);
verify_key_exist
(
hkey
,
"Subkey2a"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[
\t
-HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey2b]
\n
"
);
verify_key_exist
(
hkey
,
"Subkey2b"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[- HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey2a]
\n
"
);
verify_key_exist
(
hkey
,
"Subkey2a"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[-
\t
HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey2b
\t
]
\n
"
);
verify_key_exist
(
hkey
,
"Subkey2b"
);
exec_import_str
(
"REGEDIT4
\n\n
"
"[-HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey2a]
\n\n
"
"[-HKEY_CURRENT_USER
\\
"
KEY_BASE
"
\\
Subkey2b]
\n\n
"
);
verify_key_nonexist
(
hkey
,
"Subkey2a"
);
verify_key_nonexist
(
hkey
,
"Subkey2b"
);
lr
=
RegCloseKey
(
hkey
);
ok
(
lr
==
ERROR_SUCCESS
,
"RegCloseKey failed: got %d, expected 0
\n
"
,
lr
);
lr
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
KEY_BASE
);
todo_wine
ok
(
lr
==
ERROR_SUCCESS
,
"RegDeleteKeyA failed: got %d, expected 0
\n
"
,
lr
);
}
START_TEST
(
regedit
)
{
WCHAR
wchar_test
[]
=
{
0xFEFF
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'R'
,
'e'
,
'g'
,
...
...
@@ -1129,4 +1232,5 @@ START_TEST(regedit)
test_invalid_import_31
();
test_comments
();
test_import_with_whitespace
();
test_key_creation_and_deletion
();
}
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