X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftal%2Fpath%2Ftest%2Frun-ext_off.c;fp=ccan%2Ftal%2Fpath%2Ftest%2Frun-ext_off.c;h=ab0d0a53ab9cdc145b640ffb9b2bed65e1bb43c4;hb=892f59bdc1830443f87ad3aaeddaab2eeefb5937;hp=0000000000000000000000000000000000000000;hpb=1322fd3377cc817720f7552a80d56dba447bcfea;p=ccan diff --git a/ccan/tal/path/test/run-ext_off.c b/ccan/tal/path/test/run-ext_off.c new file mode 100644 index 00000000..ab0d0a53 --- /dev/null +++ b/ccan/tal/path/test/run-ext_off.c @@ -0,0 +1,19 @@ +#include +#include +#include + +int main(void) +{ + plan_tests(9); + + ok1(path_ext_off("foo") == 3); + ok1(path_ext_off(".foo") == 4); + ok1(path_ext_off("bar.foo") == 3); + ok1(path_ext_off("bar/foo") == 7); + ok1(path_ext_off("bar/.foo") == 8); + ok1(path_ext_off(".bar/foo") == 8); + ok1(path_ext_off("foo.bar/foo") == 11); + ok1(path_ext_off("foo.bar/foo.") == 11); + ok1(path_ext_off("foo.bar/foo..") == 12); + return exit_status(); +}