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>
This commit is contained in:
Hugh McMaster 2016-11-23 06:15:51 +00:00 committed by Alexandre Julliard
parent 9c5b15aaa4
commit a2fc092e08
1 changed files with 96 additions and 0 deletions

View File

@ -819,6 +819,9 @@ static void test_import(void)
ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
"got exit code %d, expected 1\n", r);
test_import_str("REGEDIT", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
test_import_str("REGEDIT\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
@ -944,6 +947,30 @@ static void test_import(void)
todo_wine verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword),
TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine5\"=\"No newline\"", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL);
todo_wine ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
"got %d, expected 0\n", err);
if (err == ERROR_SUCCESS)
verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine6\"=dword:00000050\n\n"
"\"Wine7\"=\"No newline\"", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x50;
todo_wine verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword),
TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL);
todo_wine ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
"got %d, expected 0\n", err);
if (err == ERROR_SUCCESS)
verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
err = RegCloseKey(hkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
@ -959,9 +986,15 @@ static void test_import(void)
ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
"got exit code %d, expected 1\n", r);
test_import_wstr("\xef\xbb\xbfREGEDIT", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
test_import_wstr("\xef\xbb\xbfREGEDIT4", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
@ -1012,6 +1045,9 @@ static void test_import(void)
ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
"got exit code %d, expected 1\n", r);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
@ -1047,6 +1083,66 @@ static void test_import(void)
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg(hkey, "Unicode6", REG_SZ, "Value6", 7, 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Line1\"=\"Value1\"\n\n"
"\"Line2\"=\"Value2\"\n\n\n"
"\"Line3\"=\"Value3\"\n\n\n\n"
"\"Line4\"=\"Value4\"\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
todo_wine verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
todo_wine verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
todo_wine verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine1\"=dword:00000782\n\n"
"\"Wine2\"=\"Test Value\"\n"
"\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\
61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
"#comment\n"
"@=\"Test\"\n"
";comment\n\n"
"\"Wine4\"=dword:12345678\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x782;
todo_wine verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword),
TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
todo_wine verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11,
TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
todo_wine verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20,
TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
todo_wine verify_reg(hkey, "", REG_SZ, "Test", 5,
TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
dword = 0x12345678;
todo_wine verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword),
TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine5\"=\"No newline\"", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL);
todo_wine ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
"got %d, expected 0\n", err);
if (err == ERROR_SUCCESS)
verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine6\"=dword:00000050\n\n"
"\"Wine7\"=\"No newline\"", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x50;
todo_wine verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword),
TODO_REG_TYPE|TODO_REG_SIZE|TODO_REG_DATA);
err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL);
todo_wine ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
"got %d, expected 0\n", err);
if (err == ERROR_SUCCESS)
verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
err = RegCloseKey(hkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);