diff options
author | Jan Janssen <medhefgo@web.de> | 2021-11-24 12:00:02 +0100 |
---|---|---|
committer | Jan Janssen <medhefgo@web.de> | 2021-11-25 15:03:06 +0100 |
commit | 4f7452a8eb7a946efea927fae017d4d661097833 (patch) | |
tree | 413778cc0fb08fbbed0890130b5ba66c90581e61 /src/test/test-specifier.c | |
parent | 4d5ad9d951299c905453ac8e3769dc82b0a09fb4 (diff) | |
download | systemd-4f7452a8eb7a946efea927fae017d4d661097833.tar.gz |
test: Use TEST macro
This converts to TEST macro where it is trivial.
Some additional notable changes:
- simplify HAVE_LIBIDN #ifdef in test-dns-domain.c
- use saved_argc/saved_argv in test-copy.c, test-path-util.c,
test-tmpfiles.c and test-unit-file.c
Diffstat (limited to 'src/test/test-specifier.c')
-rw-r--r-- | src/test/test-specifier.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/src/test/test-specifier.c b/src/test/test-specifier.c index 853943a996..40957eeb59 100644 --- a/src/test/test-specifier.c +++ b/src/test/test-specifier.c @@ -15,9 +15,7 @@ static void test_specifier_escape_one(const char *a, const char *b) { assert_se(streq_ptr(x, b)); } -static void test_specifier_escape(void) { - log_info("/* %s */", __func__); - +TEST(specifier_escape) { test_specifier_escape_one(NULL, NULL); test_specifier_escape_one("", ""); test_specifier_escape_one("%", "%%"); @@ -33,9 +31,7 @@ static void test_specifier_escape_strv_one(char **a, char **b) { assert_se(strv_equal(x, b)); } -static void test_specifier_escape_strv(void) { - log_info("/* %s */", __func__); - +TEST(specifier_escape_strv) { test_specifier_escape_strv_one(NULL, NULL); test_specifier_escape_strv_one(STRV_MAKE(NULL), STRV_MAKE(NULL)); test_specifier_escape_strv_one(STRV_MAKE(""), STRV_MAKE("")); @@ -56,7 +52,7 @@ static const Specifier specifier_table[] = { {} }; -static void test_specifier_printf(void) { +TEST(specifier_printf) { static const Specifier table[] = { { 'X', specifier_string, (char*) "AAAA" }, { 'Y', specifier_string, (char*) "BBBB" }, @@ -67,8 +63,6 @@ static void test_specifier_printf(void) { _cleanup_free_ char *w = NULL; int r; - log_info("/* %s */", __func__); - r = specifier_printf("xxx a=%X b=%Y yyy", SIZE_MAX, table, NULL, NULL, &w); assert_se(r >= 0); assert_se(w); @@ -88,9 +82,7 @@ static void test_specifier_printf(void) { puts(w); } -static void test_specifiers(void) { - log_info("/* %s */", __func__); - +TEST(specifiers) { for (const Specifier *s = specifier_table; s->specifier; s++) { char spec[3]; _cleanup_free_ char *resolved = NULL; @@ -103,13 +95,4 @@ static void test_specifiers(void) { } } -int main(int argc, char *argv[]) { - test_setup_logging(LOG_DEBUG); - - test_specifier_escape(); - test_specifier_escape_strv(); - test_specifier_printf(); - test_specifiers(); - - return 0; -} +DEFINE_TEST_MAIN(LOG_DEBUG); |