Hugh McMaster : reg/tests: Add verify_reg_nonexist helper function.
Alexandre Julliard
julliard at winehq.org
Wed Dec 7 15:20:30 CST 2016
Module: wine
Branch: master
Commit: be3a4c26137dcfe81c80de7aca834f96dea45515
URL: http://source.winehq.org/git/wine.git/?a=commit;h=be3a4c26137dcfe81c80de7aca834f96dea45515
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Wed Dec 7 08:47:58 2016 +0000
reg/tests: Add verify_reg_nonexist helper function.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/reg/tests/reg.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c
index 6447d45..cbd4149 100644
--- a/programs/reg/tests/reg.c
+++ b/programs/reg/tests/reg.c
@@ -81,6 +81,16 @@ static void verify_reg_(unsigned line, HKEY hkey, const char* value,
lok(memcmp(data, exp_data, size) == 0, "got wrong data\n");
}
+#define verify_reg_nonexist(k,v) verify_reg_nonexist_(__LINE__,k,v)
+static void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value)
+{
+ LONG err;
+
+ err = RegQueryValueExA(hkey, value, NULL, NULL, NULL, NULL);
+ lok(err == ERROR_FILE_NOT_FOUND, "registry value '%s' shouldn't exist; got %d, expected 2\n",
+ value, err);
+}
+
static void test_add(void)
{
HKEY hkey, subkey;
@@ -499,18 +509,15 @@ static void test_delete(void)
run_reg_exe("reg delete HKCU\\" KEY_BASE " /v bar /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- err = RegQueryValueExA(hkey, "bar", NULL, NULL, NULL, NULL);
- ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
+ verify_reg_nonexist(hkey, "bar");
run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- err = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL);
- ok(err == ERROR_FILE_NOT_FOUND, "got %d, expected 2\n", err);
+ verify_reg_nonexist(hkey, "");
run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- err = RegQueryValueExA(hkey, "foo", NULL, NULL, NULL, NULL);
- ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
+ verify_reg_nonexist(hkey, "foo");
err = RegOpenKeyExA(hkey, "subkey", 0, KEY_READ, &hsubkey);
ok(err == ERROR_SUCCESS, "got %d\n", err);
RegCloseKey(hsubkey);
More information about the wine-cvs
mailing list