reg/tests: Add further syntax tests for the 'copy' command.
[wine.git] / programs / reg / tests / copy.c
blob0d245dae4daa55b0afea875ee9e71e8e3089381f
1 /*
2 * Copyright 2021 Hugh McMaster
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "reg_test.h"
21 #define COPY_SRC KEY_WINE "\\reg_copy"
23 static void test_command_syntax(void)
25 DWORD r;
27 run_reg_exe("reg copy", &r);
28 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
30 run_reg_exe("reg copy /?", &r);
31 todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
33 run_reg_exe("reg copy /h", &r);
34 todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
36 run_reg_exe("reg copy -H", &r);
37 todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
39 run_reg_exe("reg copy /? /f", &r);
40 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
42 run_reg_exe("reg copy /h /f", &r);
43 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
45 run_reg_exe("reg copy /? /s", &r);
46 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
48 run_reg_exe("reg copy /h /s", &r);
49 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
51 run_reg_exe("reg copy /f", &r);
52 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
54 run_reg_exe("reg copy /s", &r);
55 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
57 run_reg_exe("reg copy /s /f", &r);
58 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
60 run_reg_exe("reg copy /f /s", &r);
61 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
63 run_reg_exe("reg copy HKCU\\" COPY_SRC " /f", &r);
64 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
66 run_reg_exe("reg copy HKCU\\" COPY_SRC " foo /f", &r);
67 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
69 run_reg_exe("reg copy /f HKCU\\" COPY_SRC " HKCU\\" KEY_BASE, &r);
70 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
72 run_reg_exe("reg copy HKCU\\" COPY_SRC " /f HKCU\\" KEY_BASE, &r);
73 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
75 run_reg_exe("reg copy HKCU\\" COPY_SRC " /s HKCU\\" KEY_BASE, &r);
76 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
78 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /a", &r);
79 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
81 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE " /f /a", &r);
82 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
84 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\", &r);
85 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
87 /* Source and destination keys are the same */
88 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC, &r);
89 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
91 run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC, &r);
92 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
94 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\", &r);
95 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
97 run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\", &r);
98 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
100 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC " /f", &r);
101 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
103 run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC " /f", &r);
104 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
106 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\ /f", &r);
107 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
109 run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\ /f", &r);
110 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
112 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC " /s /f", &r);
113 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
115 run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC " /s /f", &r);
116 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
118 run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" COPY_SRC "\\ /s /f", &r);
119 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
121 run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" COPY_SRC "\\ /s /f", &r);
122 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
125 START_TEST(copy)
127 DWORD r;
129 if (!run_reg_exe("reg.exe /?", &r)) {
130 win_skip("reg.exe not available, skipping 'copy' tests\n");
131 return;
134 test_command_syntax();