X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftal%2Fstr%2Ftest%2Frun-strreg.c;h=47671efd9270ec4a65d2ec7253fb65db5f31a257;hp=cf0b9b1d9a8a888a8616b36ae9df1b9bc8f04633;hb=15ed4f453713f1a7bdeec22b53704819fa3d447f;hpb=737dcc0fe959d67eb29f57df37b0d7f188e0213d;ds=inline diff --git a/ccan/tal/str/test/run-strreg.c b/ccan/tal/str/test/run-strreg.c index cf0b9b1d..47671efd 100644 --- a/ccan/tal/str/test/run-strreg.c +++ b/ccan/tal/str/test/run-strreg.c @@ -22,23 +22,23 @@ int main(int argc, char *argv[]) plan_tests(40); /* Simple matching. */ - ok1(strreg(ctx, "hello world!", "hello") == true); - ok1(strreg(ctx, "hello world!", "hi") == false); + ok1(tal_strreg(ctx, "hello world!", "hello") == true); + ok1(tal_strreg(ctx, "hello world!", "hi") == false); /* No parentheses means we don't use any extra args. */ - ok1(strreg(ctx, "hello world!", "hello", invalid) == true); - ok1(strreg(ctx, "hello world!", "hi", invalid) == false); + ok1(tal_strreg(ctx, "hello world!", "hello", invalid) == true); + ok1(tal_strreg(ctx, "hello world!", "hi", invalid) == false); - ok1(strreg(ctx, "hello world!", "[a-z]+", invalid) == true); - ok1(strreg(ctx, "hello world!", "([a-z]+)", &a, invalid) == true); + ok1(tal_strreg(ctx, "hello world!", "[a-z]+", invalid) == true); + ok1(tal_strreg(ctx, "hello world!", "([a-z]+)", &a, invalid) == true); /* Found string */ ok1(streq(a, "hello")); /* Allocated off ctx */ ok1(find_parent(a, ctx)); tal_free(a); - ok1(strreg(ctx, "hello world!", "([a-z]*) ([a-z]+)", - &a, &b, invalid) == true); + ok1(tal_strreg(ctx, "hello world!", "([a-z]*) ([a-z]+)", + &a, &b, invalid) == true); ok1(streq(a, "hello")); ok1(streq(b, "world")); ok1(find_parent(a, ctx)); @@ -47,32 +47,32 @@ int main(int argc, char *argv[]) tal_free(b); /* * after parentheses returns last match. */ - ok1(strreg(ctx, "hello world!", "([a-z])* ([a-z]+)", - &a, &b, invalid) == true); + ok1(tal_strreg(ctx, "hello world!", "([a-z])* ([a-z]+)", + &a, &b, invalid) == true); ok1(streq(a, "o")); ok1(streq(b, "world")); tal_free(a); tal_free(b); /* Nested parentheses are ordered by open brace. */ - ok1(strreg(ctx, "hello world!", "(([a-z]*) world)", - &a, &b, invalid) == true); + ok1(tal_strreg(ctx, "hello world!", "(([a-z]*) world)", + &a, &b, invalid) == true); ok1(streq(a, "hello world")); ok1(streq(b, "hello")); tal_free(a); tal_free(b); /* Nested parentheses are ordered by open brace. */ - ok1(strreg(ctx, "hello world!", "(([a-z]*) world)", - &a, &b, invalid) == true); + ok1(tal_strreg(ctx, "hello world!", "(([a-z]*) world)", + &a, &b, invalid) == true); ok1(streq(a, "hello world")); ok1(streq(b, "hello")); tal_free(a); tal_free(b); /* NULL means we're not interested. */ - ok1(strreg(ctx, "hello world!", "((hello|goodbye) world)", - &a, NULL, invalid) == true); + ok1(tal_strreg(ctx, "hello world!", "((hello|goodbye) world)", + &a, NULL, invalid) == true); ok1(streq(a, "hello world")); tal_free(a); @@ -80,12 +80,12 @@ int main(int argc, char *argv[]) ok1(!tal_first(ctx)); /* NULL arg with take means always fail. */ - ok1(strreg(ctx, take(NULL), "((hello|goodbye) world)", - &b, NULL, invalid) == false); + ok1(tal_strreg(ctx, take(NULL), "((hello|goodbye) world)", + &b, NULL, invalid) == false); /* Take string. */ a = tal_strdup(ctx, "hello world!"); - ok1(strreg(ctx, take(a), "([a-z]+)", &b, invalid) == true); + ok1(tal_strreg(ctx, take(a), "([a-z]+)", &b, invalid) == true); ok1(streq(b, "hello")); ok1(tal_parent(b) == ctx); tal_free(b); @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) /* Take regex. */ a = tal_strdup(ctx, "([a-z]+)"); - ok1(strreg(ctx, "hello world!", take(a), &b, invalid) == true); + ok1(tal_strreg(ctx, "hello world!", take(a), &b, invalid) == true); ok1(streq(b, "hello")); ok1(tal_parent(b) == ctx); tal_free(b); @@ -101,8 +101,8 @@ int main(int argc, char *argv[]) /* Take both. */ a = tal_strdup(ctx, "([a-z]+)"); - ok1(strreg(ctx, take(tal_strdup(ctx, "hello world!")), - take(a), &b, invalid) == true); + ok1(tal_strreg(ctx, take(tal_strdup(ctx, "hello world!")), + take(a), &b, invalid) == true); ok1(streq(b, "hello")); ok1(tal_parent(b) == ctx); tal_free(b); @@ -110,8 +110,8 @@ int main(int argc, char *argv[]) /* ... even if we fail to match. */ a = tal_strdup(ctx, "([a-z]+)"); - ok1(strreg(ctx, take(tal_strdup(ctx, "HELLO WORLD!")), - take(a), &b, invalid) == false); + ok1(tal_strreg(ctx, take(tal_strdup(ctx, "HELLO WORLD!")), + take(a), &b, invalid) == false); ok1(tal_first(ctx) == NULL); tal_free(ctx);