summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Buch <boogiewasthere@gmail.com>2013-02-17 20:15:52 +0100
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-02-18 23:57:56 +0100
commit9f316366482471667dca20aba34c1f3a36fd56c3 (patch)
tree216799cf34a9681adfda6d895f4217166ba99b29
parent04045d8426fa03fc4414d71b0454c47e951840d8 (diff)
test-strv.c: ported test_specifier_printf() to _cleanup_free_ + assert_se + cleanup
-rw-r--r--src/test/test-strv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index 7f475a6f4c..504415ac0c 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) {