From: Hugh McMaster hugh.mcmaster@outlook.com
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/reg.c | 80 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index ea4e128da5a..afba8424c1a 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -21,7 +21,8 @@ #include "wine/test.h"
#define lok ok_(__FILE__,line) -#define KEY_BASE "Software\Wine\reg_test" +#define KEY_WINE "Software\Wine" +#define KEY_BASE KEY_WINE "\reg_test" #define REG_EXIT_SUCCESS 0 #define REG_EXIT_FAILURE 1 #define TODO_REG_TYPE (0x0001u) @@ -4684,6 +4685,82 @@ static void test_export(void) delete_key(HKEY_CURRENT_USER, KEY_BASE); }
+#define COPY_DEST KEY_WINE "\reg_copy" + +static void test_copy(void) +{ + DWORD r; + + run_reg_exe("reg copy", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /?", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg copy /h", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg copy -H", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg copy /? /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /h /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /? /s", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /h /s", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /s", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /s /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /f /s", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" KEY_BASE " /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" KEY_BASE " foo /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" KEY_BASE " HKEY_CURRENT_USER\" KEY_BASE" /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /f HKEY_CURRENT_USER\" KEY_BASE " HKEY_CURRENT_USER\" KEY_BASE, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy /f HKEY_CURRENT_USER\" KEY_BASE " HKEY_CURRENT_USER\" COPY_DEST, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" KEY_BASE " /f HKEY_CURRENT_USER\" COPY_DEST, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" KEY_BASE " /s HKEY_CURRENT_USER\" COPY_DEST, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" COPY_DEST " HKEY_CURRENT_USER\" KEY_BASE, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" COPY_DEST " HKEY_CURRENT_USER\" KEY_BASE, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" KEY_BASE " HKEY_CURRENT_USER\" COPY_DEST "/a", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg copy HKEY_CURRENT_USER\" KEY_BASE " HKEY_CURRENT_USER\" COPY_DEST "/f /a", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); +} + START_TEST(reg) { DWORD r; @@ -4702,4 +4779,5 @@ START_TEST(reg) test_unicode_import_with_whitespace(); test_import_31(); test_export(); + test_copy(); }