X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftal%2Fstr%2Ftest%2Frun-string.c;h=8d596e462e13a006a86ea46cfbf1a47af0a1d952;hp=7bf31a6cf6bce7057423e9dff1d9c4e7941f4cc3;hb=97d99004bec31012400b6c1d9bad045ae1c9b075;hpb=3d5a1a3290b2075fbf4e60df37596668dfd6b898 diff --git a/ccan/tal/str/test/run-string.c b/ccan/tal/str/test/run-string.c index 7bf31a6c..8d596e46 100644 --- a/ccan/tal/str/test/run-string.c +++ b/ccan/tal/str/test/run-string.c @@ -1,6 +1,7 @@ #include #include #include +#include "helper.h" int main(void) { @@ -21,7 +22,11 @@ int main(void) ok1(tal_parent(c) == parent); tal_free(c); +#ifdef TAL_USE_TALLOC + c = tal_talloc_typechk_(parent, char *); +#else c = tal_typechk_(parent, char *); +#endif c = tal_dup(parent, char, "hello", 6, 0); ok1(strcmp(c, "hello") == 0); ok1(strcmp(tal_name(c), "char[]") == 0); @@ -49,26 +54,26 @@ int main(void) c = tal_strcat(parent, take(c), " again"); ok1(strcmp(c, "hello there again") == 0); ok1(tal_parent(c) == parent); - ok1(tal_first(parent) == c && !tal_next(parent, c)); + ok1(single_child(parent, c)); c = tal_strcat(parent, "And ", take(c)); ok1(strcmp(c, "And hello there again") == 0); ok1(tal_parent(c) == parent); - ok1(tal_first(parent) == c && !tal_next(parent, c)); + ok1(single_child(parent, c)); /* NULL pass through works... */ c = tal_strcat(parent, take(NULL), take(c)); ok1(!c); - ok1(!tal_first(parent)); + ok1(no_children(parent)); c = tal_strcat(parent, take(tal_strdup(parent, "hi")), take(NULL)); ok1(!c); - ok1(!tal_first(parent)); + ok1(no_children(parent)); c = tal_strcat(parent, take(NULL), take(NULL)); ok1(!c); - ok1(!tal_first(parent)); + ok1(no_children(parent)); /* Appending formatted strings. */ c = tal_strdup(parent, "hi");