shell32/tests: Model the okChildXxx() shlexec macros after the standard ok() macro.

Francois Gouget fgouget at codeweavers.com
Thu Jan 14 17:57:26 CST 2016


This way when the compiler says argument 5 is wrong it's really the fifth argument that's at fault and not the third.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 dlls/shell32/tests/shlexec.c | 46 +++++++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index 6ad5a37..2bff747 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -720,54 +720,60 @@ static int StrCmpPath(const char* s1, const char* s2)
     return 0;
 }
 
-static void _okChildString(const char* file, int line, const char* key, const char* expected, const char* bad)
+static void _okChildStringBroken(const char* key, const char* expected, const char* bad)
 {
     char* result;
     result=getChildString("Arguments", key);
     if (!result)
     {
-        ok_(file, line)(FALSE, "%s expected '%s', but key not found or empty\n", key, expected);
+        winetest_ok(FALSE, "%s expected '%s', but key not found or empty\n", key, expected);
         return;
     }
-    ok_(file, line)(lstrcmpiA(result, expected) == 0 ||
-                    broken(lstrcmpiA(result, bad) == 0),
-                    "%s expected '%s', got '%s'\n", key, expected, result);
+    winetest_ok(lstrcmpiA(result, expected) == 0 ||
+                broken(lstrcmpiA(result, bad) == 0),
+                "%s expected '%s', got '%s'\n", key, expected, result);
 }
 
-static void _okChildPath(const char* file, int line, const char* key, const char* expected)
+static void _okChildString(const char* key, const char* expected)
+{
+    _okChildStringBroken(key, expected, expected);
+}
+
+static void _okChildPath(const char* key, const char* expected)
 {
     char* result;
     result=getChildString("Arguments", key);
     if (!result)
     {
-        ok_(file, line)(FALSE, "%s expected '%s', but key not found or empty\n", key, expected);
+        winetest_ok(FALSE, "%s expected '%s', but key not found or empty\n", key, expected);
         return;
     }
-    ok_(file, line)(StrCmpPath(result, expected) == 0,
-                    "%s expected '%s', got '%s'\n", key, expected, result);
+    winetest_ok(StrCmpPath(result, expected) == 0,
+                "%s expected '%s', got '%s'\n", key, expected, result);
 }
 
-static void _okChildInt(const char* file, int line, const char* key, int expected)
+static void _okChildInt(const char* key, int expected)
 {
     INT result;
     result=GetPrivateProfileIntA("Arguments", key, expected, child_file);
-    ok_(file, line)(result == expected,
-                    "%s expected %d, but got %d\n", key, expected, result);
+    winetest_ok(result == expected,
+                "%s expected %d, but got %d\n", key, expected, result);
 }
 
-static void _okChildIntBroken(const char* file, int line, const char* key, int expected)
+static void _okChildIntBroken(const char* key, int expected)
 {
     INT result;
     result=GetPrivateProfileIntA("Arguments", key, expected, child_file);
-    ok_(file, line)(result == expected || broken(result != expected),
-                    "%s expected %d, but got %d\n", key, expected, result);
+    winetest_ok(result == expected || broken(result != expected),
+                "%s expected %d, but got %d\n", key, expected, result);
 }
 
-#define okChildString(key, expected) _okChildString(__FILE__, __LINE__, (key), (expected), (expected))
-#define okChildStringBroken(key, expected, broken) _okChildString(__FILE__, __LINE__, (key), (expected), (broken))
-#define okChildPath(key, expected) _okChildPath(__FILE__, __LINE__, (key), (expected))
-#define okChildInt(key, expected) _okChildInt(__FILE__, __LINE__, (key), (expected))
-#define okChildIntBroken(key, expected) _okChildIntBroken(__FILE__, __LINE__, (key), (expected))
+#define okChildString (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : _okChildString
+#define okChildStringBroken (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : _okChildStringBroken
+#define okChildPath (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : _okChildPath
+#define okChildInt (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : _okChildInt
+#define okChildIntBroken (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : _okChildIntBroken
+
 
 /***
  *
-- 
2.6.4



More information about the wine-patches mailing list