X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftest%2Ftest-strv.c;h=c3d536d0579bca2c12bb9613d76279bdb2ad6a87;hp=25bee22dfe9c4f91e0d0c92a766f585f9c84fc0e;hb=872c8faaf2009422a91d227ae0b5c6f04c9d2c69;hpb=a6fde35332f5e7f78bff437d7b7bfded83debbaa diff --git a/src/test/test-strv.c b/src/test/test-strv.c index 25bee22df..c3d536d05 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -27,19 +27,31 @@ #include "strv.h" static void test_specifier_printf(void) { - _cleanup_free_ char *w = NULL; - - const Specifier table[] = { + static const Specifier table[] = { { 'a', specifier_string, (char*) "AAAA" }, { 'b', specifier_string, (char*) "BBBB" }, - { 0, NULL, NULL } + { 'm', specifier_machine_id, NULL }, + { 'B', specifier_boot_id, NULL }, + { 'H', specifier_host_name, NULL }, + { 'v', specifier_kernel_release, NULL }, + {} }; - w = specifier_printf("xxx a=%a b=%b yyy", table, NULL); - puts(w); + _cleanup_free_ char *w = NULL; + int r; + r = specifier_printf("xxx a=%a b=%b yyy", table, NULL, &w); + assert_se(r >= 0); assert_se(w); + + puts(w); assert_se(streq(w, "xxx a=AAAA b=BBBB yyy")); + + free(w); + r = specifier_printf("machine=%m, boot=%B, host=%H, version=%v", table, NULL, &w); + assert_se(r >= 0); + assert_se(w); + puts(w); } static const char* const input_table_multiple[] = {