Преглед изворни кода

libdpkg: Move test_warn() and test_error() to dpkg/test.h

These are generic test macros that can be reused by other test cases.
Guillem Jover пре 12 година
родитељ
комит
e231f923b7
2 измењених фајлова са 12 додато и 11 уклоњено
  1. 12 0
      lib/dpkg/test.h
  2. 0 11
      lib/dpkg/test/t-version.c

+ 12 - 0
lib/dpkg/test.h

@@ -107,6 +107,18 @@ static const char *test_skip_reason;
 #define test_mem(a, op, b, size) \
 	test_case(memcmp((a), (b), (size)) op 0, "memcmp %p %s %p", a, #op, b)
 
+/* Specific test macros. */
+#define test_warn(e) \
+	do { \
+		test_pass((e).type == DPKG_MSG_WARN); \
+		dpkg_error_destroy(&(e)); \
+	} while (0)
+#define test_error(e) \
+	do { \
+		test_pass((e).type == DPKG_MSG_ERROR); \
+		dpkg_error_destroy(&(e)); \
+	} while (0)
+
 /** @} */
 
 #ifndef TEST_MAIN_PROVIDED

+ 0 - 11
lib/dpkg/test/t-version.c

@@ -148,17 +148,6 @@ test_version_relate(void)
 	test_pass(dpkg_version_relate(&a, dpkg_relation_ge, &b));
 }
 
-#define test_warn(e) \
-	do { \
-		test_pass((e).type == DPKG_MSG_WARN); \
-		dpkg_error_destroy(&(e)); \
-	} while (0)
-#define test_error(e) \
-	do { \
-		test_pass((e).type == DPKG_MSG_ERROR); \
-		dpkg_error_destroy(&(e)); \
-	} while (0)
-
 static void
 test_version_parse(void)
 {