reg/tests: Delete the test registry key before starting each test.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-09-05 12:26:44 +00:00 committed by Alexandre Julliard
parent 38d314ba92
commit e3395d50a7
1 changed files with 18 additions and 0 deletions

View File

@ -507,6 +507,9 @@ static void test_delete(void)
DWORD r;
const DWORD deadbeef = 0xdeadbeef;
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
run_reg_exe("reg delete", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@ -564,6 +567,9 @@ static void test_query(void)
const DWORD dword1 = 0x123;
const DWORD dword2 = 0xabc;
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
run_reg_exe("reg query", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@ -800,6 +806,9 @@ static void test_import(void)
LONG err;
BYTE hex[8];
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
run_reg_exe("reg import", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@ -2314,6 +2323,9 @@ static void test_unicode_import(void)
char buffer[24];
BYTE hex[8];
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
test_import_wstr("REGEDIT\n", &r);
ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
"got exit code %d, expected 1\n", r);
@ -3800,6 +3812,9 @@ static void test_import_with_whitespace(void)
DWORD r, dword;
LONG err;
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
test_import_str(" REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
@ -3947,6 +3962,9 @@ static void test_unicode_import_with_whitespace(void)
DWORD r, dword;
LONG err;
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);