X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftal%2Fstr%2Ftest%2Frun-strreg.c;h=6d126f3970a13acdbed21cbb63e0115e1aa9d477;hp=47671efd9270ec4a65d2ec7253fb65db5f31a257;hb=97d99004bec31012400b6c1d9bad045ae1c9b075;hpb=3d5a1a3290b2075fbf4e60df37596668dfd6b898;ds=sidebyside diff --git a/ccan/tal/str/test/run-strreg.c b/ccan/tal/str/test/run-strreg.c index 47671efd..6d126f39 100644 --- a/ccan/tal/str/test/run-strreg.c +++ b/ccan/tal/str/test/run-strreg.c @@ -1,6 +1,7 @@ #include #include #include +#include "helper.h" static bool find_parent(tal_t *child, tal_t *parent) { @@ -77,7 +78,7 @@ int main(int argc, char *argv[]) tal_free(a); /* No leaks! */ - ok1(!tal_first(ctx)); + ok1(no_children(ctx)); /* NULL arg with take means always fail. */ ok1(tal_strreg(ctx, take(NULL), "((hello|goodbye) world)", @@ -89,7 +90,7 @@ int main(int argc, char *argv[]) ok1(streq(b, "hello")); ok1(tal_parent(b) == ctx); tal_free(b); - ok1(tal_first(ctx) == NULL); + ok1(no_children(ctx)); /* Take regex. */ a = tal_strdup(ctx, "([a-z]+)"); @@ -97,7 +98,7 @@ int main(int argc, char *argv[]) ok1(streq(b, "hello")); ok1(tal_parent(b) == ctx); tal_free(b); - ok1(tal_first(ctx) == NULL); + ok1(no_children(ctx)); /* Take both. */ a = tal_strdup(ctx, "([a-z]+)"); @@ -106,13 +107,13 @@ int main(int argc, char *argv[]) ok1(streq(b, "hello")); ok1(tal_parent(b) == ctx); tal_free(b); - ok1(tal_first(ctx) == NULL); + ok1(no_children(ctx)); /* ... even if we fail to match. */ a = tal_strdup(ctx, "([a-z]+)"); ok1(tal_strreg(ctx, take(tal_strdup(ctx, "HELLO WORLD!")), take(a), &b, invalid) == false); - ok1(tal_first(ctx) == NULL); + ok1(no_children(ctx)); tal_free(ctx); return exit_status();