summaryrefslogtreecommitdiff
path: root/ccan/tal/path/test/run-ext_off.c
blob: ab0d0a53ab9cdc145b640ffb9b2bed65e1bb43c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <ccan/tal/path/path.h>
#include <ccan/tal/path/path.c>
#include <ccan/tap/tap.h>

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();
}