X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftest%2Ftest-strv.c;h=504415ac0ce0530ca8dc61fac3b9cb37d368f550;hp=7f475a6f4cb3f71b282e4fe08dcd7b48d9676a71;hb=9f316366482471667dca20aba34c1f3a36fd56c3;hpb=04045d8426fa03fc4414d71b0454c47e951840d8 diff --git a/src/test/test-strv.c b/src/test/test-strv.c index 7f475a6f4..504415ac0 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -27,7 +27,7 @@ #include "strv.h" static void test_specifier_printf(void) { - char *w; + _cleanup_free_ char *w = NULL; const Specifier table[] = { { 'a', specifier_string, (char*) "AAAA" }, @@ -36,8 +36,10 @@ static void test_specifier_printf(void) { }; w = specifier_printf("xxx a=%a b=%b yyy", table, NULL); - printf("<%s>\n", w); - free(w); + puts(w); + + assert_se(w); + assert_se(streq(w, "xxx a=AAAA b=BBBB yyy")); } static void test_strv_find(void) {