chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce udev object cleanup functions
[elogind.git]
/
src
/
test
/
test-strv.c
diff --git
a/src/test/test-strv.c
b/src/test/test-strv.c
index 25bee22dfe9c4f91e0d0c92a766f585f9c84fc0e..c3d536d0579bca2c12bb9613d76279bdb2ad6a87 100644
(file)
--- 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) {
#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" },
{ '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);
assert_se(w);
+
+ puts(w);
assert_se(streq(w, "xxx a=AAAA b=BBBB yyy"));
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[] = {
}
static const char* const input_table_multiple[] = {