reg/tests: Move key format test section below first key creation.

This commit is contained in:
Jonathan Vollebregt 2014-11-03 22:10:45 +01:00 committed by Alexandre Julliard
parent 375f9c9905
commit 1256177dc2
1 changed files with 12 additions and 14 deletions

View File

@ -88,7 +88,7 @@ static void verify_reg_(unsigned line, HKEY hkey, const char* value,
static void test_add(void)
{
HKEY hkey;
HKEY hkey, subkey;
LONG err;
DWORD r, dword, type, size;
char buffer[22];
@ -102,6 +102,13 @@ static void test_add(void)
err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey);
ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey);
ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err);
/* Test input key formats */
run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest0");
@ -121,29 +128,20 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3", 0, KEY_READ, &hkey);
err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3", 0, KEY_READ, &subkey);
ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err);
RegCloseKey(hkey);
RegCloseKey(subkey);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3");
ok(err == ERROR_SUCCESS, "got exit code %d\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest4 /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4", 0, KEY_READ, &hkey);
err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4", 0, KEY_READ, &subkey);
ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err);
RegCloseKey(hkey);
RegCloseKey(subkey);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4");
ok(err == ERROR_SUCCESS, "got exit code %d\n", r);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS, "got exit code %d\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey);
ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err);
/* REG_SZ */
run_reg_exe("reg add HKCU\\" KEY_BASE " /d WineTest /f", &r);
ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */),