regedit/tests: Add import tests with various combinations of spaces and tabs.
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
459134b855
commit
0b513778c7
|
@ -643,6 +643,117 @@ static void test_comments(void)
|
|||
ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: %d\n", lr);
|
||||
}
|
||||
|
||||
static void test_import_with_whitespace(void)
|
||||
{
|
||||
HKEY hkey;
|
||||
LONG lr;
|
||||
DWORD dword;
|
||||
|
||||
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);
|
||||
|
||||
exec_import_str(" REGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\"Wine1a\"=\"Value\"\n\n");
|
||||
verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0);
|
||||
|
||||
exec_import_str("\tREGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\"Wine1b\"=\"Value\"\n\n");
|
||||
verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0);
|
||||
|
||||
exec_import_str(" \t REGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\"Wine1c\"=\"Value\"\n\n");
|
||||
verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
" [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\"Wine2a\"=\"Value\"\n\n");
|
||||
todo_wine verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
"\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\"Wine2b\"=\"Value\"\n\n");
|
||||
todo_wine verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
" \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\"Wine2c\"=\"Value\"\n\n");
|
||||
todo_wine verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
" \"Wine3a\"=\"Two leading spaces\"\n\n");
|
||||
todo_wine verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\t\"Wine3b\"=\"One leading tab\"\n\n");
|
||||
todo_wine verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
" \t \"Wine3c\"=\"Space, tab, space\"\n\n");
|
||||
todo_wine verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0);
|
||||
|
||||
exec_import_str(" REGEDIT4\n\n"
|
||||
"\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\t \"Wine4a\"=\"Tab and four spaces\"\n"
|
||||
" \"Wine4b\"=dword:00112233\n"
|
||||
"\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n"
|
||||
" 63,6f,6e,\\;comment\n"
|
||||
"\t\t\t\t63,61,74,\\;comment\n"
|
||||
" \t65,6e,61,74,69,6f,6e,00,00\n\n");
|
||||
todo_wine verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0);
|
||||
dword = 0x112233;
|
||||
todo_wine verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0);
|
||||
todo_wine verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
|
||||
|
||||
exec_import_str(" REGEDIT4\n\n"
|
||||
"\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
" \"Wine5a\"=\"Leading spaces\"\n"
|
||||
"\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
|
||||
"\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
|
||||
" \"Wine5d\" \t = \t \"More whitespace\"\n\n");
|
||||
todo_wine verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0);
|
||||
todo_wine verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0);
|
||||
todo_wine verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0);
|
||||
todo_wine verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\" Wine6a\"=\"Leading spaces\"\n"
|
||||
"\"\t\tWine6b\"=\"Leading tabs\"\n"
|
||||
" \" Wine6c \" = \" Spaces everywhere \" \n\n");
|
||||
verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0);
|
||||
verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0);
|
||||
todo_wine verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\"Wine7a\"=\" Four spaces in the data\"\n"
|
||||
"\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n");
|
||||
verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0);
|
||||
verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0);
|
||||
|
||||
exec_import_str("REGEDIT4\n\n"
|
||||
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
|
||||
"\"Wine8a\"=\"Trailing spaces\" \n"
|
||||
"\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n");
|
||||
verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0);
|
||||
verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0);
|
||||
|
||||
lr = RegCloseKey(hkey);
|
||||
ok(lr == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", lr);
|
||||
|
||||
lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
|
||||
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',
|
||||
|
@ -660,4 +771,5 @@ START_TEST(regedit)
|
|||
test_basic_import_31();
|
||||
test_invalid_import();
|
||||
test_comments();
|
||||
test_import_with_whitespace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue