X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftal%2Fstr%2Ftest%2Frun-strreg.c;h=55e244c61e7bba769326a331dee91622bcdca478;hp=93b8602a3c1f8ab067c4406ece439db949ae6b5b;hb=55d814230f7fb628bb5303cd53498209c7928040;hpb=1651e25ee7cf7a24692e7ffa0c6fc9a47218eb6d diff --git a/ccan/tal/str/test/run-strreg.c b/ccan/tal/str/test/run-strreg.c index 93b8602a..55e244c6 100644 --- a/ccan/tal/str/test/run-strreg.c +++ b/ccan/tal/str/test/run-strreg.c @@ -21,7 +21,7 @@ int main(void) /* If it accesses this, it will crash. */ char **invalid = (char **)1L; - plan_tests(41); + plan_tests(54); /* Simple matching. */ ok1(tal_strreg(ctx, "hello world!", "hello") == true); ok1(tal_strreg(ctx, "hello world!", "hi") == false); @@ -36,12 +36,15 @@ int main(void) ok1(streq(a, "hello")); /* Allocated off ctx */ ok1(find_parent(a, ctx)); + ok1(tal_count(a) == strlen(a) + 1); tal_free(a); ok1(tal_strreg(ctx, "hello world!", "([a-z]*) ([a-z]+)", &a, &b, invalid) == true); ok1(streq(a, "hello")); ok1(streq(b, "world")); + ok1(tal_count(a) == strlen(a) + 1); + ok1(tal_count(b) == strlen(b) + 1); ok1(find_parent(a, ctx)); ok1(find_parent(b, ctx)); tal_free(a); @@ -52,6 +55,8 @@ int main(void) &a, &b, invalid) == true); ok1(streq(a, "o")); ok1(streq(b, "world")); + ok1(tal_count(a) == strlen(a) + 1); + ok1(tal_count(b) == strlen(b) + 1); tal_free(a); tal_free(b); @@ -60,6 +65,8 @@ int main(void) &a, &b, invalid) == true); ok1(streq(a, "hello world")); ok1(streq(b, "hello")); + ok1(tal_count(a) == strlen(a) + 1); + ok1(tal_count(b) == strlen(b) + 1); tal_free(a); tal_free(b); @@ -68,6 +75,8 @@ int main(void) &a, &b, invalid) == true); ok1(streq(a, "hello world")); ok1(streq(b, "hello")); + ok1(tal_count(a) == strlen(a) + 1); + ok1(tal_count(b) == strlen(b) + 1); tal_free(a); tal_free(b); @@ -75,6 +84,7 @@ int main(void) ok1(tal_strreg(ctx, "hello world!", "((hello|goodbye) world)", &a, NULL, invalid) == true); ok1(streq(a, "hello world")); + ok1(tal_count(a) == strlen(a) + 1); tal_free(a); /* No leaks! */ @@ -88,6 +98,7 @@ int main(void) a = tal_strdup(ctx, "hello world!"); ok1(tal_strreg(ctx, take(a), "([a-z]+)", &b, invalid) == true); ok1(streq(b, "hello")); + ok1(tal_count(b) == strlen(b) + 1); ok1(tal_parent(b) == ctx); tal_free(b); ok1(no_children(ctx)); @@ -96,6 +107,7 @@ int main(void) a = tal_strdup(ctx, "([a-z]+)"); ok1(tal_strreg(ctx, "hello world!", take(a), &b, invalid) == true); ok1(streq(b, "hello")); + ok1(tal_count(b) == strlen(b) + 1); ok1(tal_parent(b) == ctx); tal_free(b); ok1(no_children(ctx)); @@ -105,6 +117,7 @@ int main(void) ok1(tal_strreg(ctx, take(tal_strdup(ctx, "hello world!")), take(a), &b, invalid) == true); ok1(streq(b, "hello")); + ok1(tal_count(b) == strlen(b) + 1); ok1(tal_parent(b) == ctx); tal_free(b); ok1(no_children(ctx));