1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00

test-path-util: check that dot components are irrelevant for path comparisons

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-06-23 16:05:47 +02:00
parent a79726113a
commit 6d216bdd07

View File

@ -126,6 +126,8 @@ static void test_path_compare_one(const char *a, const char *b, int expected) {
}
static void test_path_compare(void) {
log_info("/* %s */", __func__);
test_path_compare_one("/goo", "/goo", 0);
test_path_compare_one("/goo", "/goo", 0);
test_path_compare_one("//goo", "/goo", 0);
@ -138,6 +140,12 @@ static void test_path_compare(void) {
test_path_compare_one("/x", "x/", 1);
test_path_compare_one("x/", "/", -1);
test_path_compare_one("/x/./y", "x/y", 1);
test_path_compare_one("/x/./y", "/x/y", 0);
test_path_compare_one("/x/./././y", "/x/y/././.", 0);
test_path_compare_one("./x/./././y", "./x/y/././.", 0);
test_path_compare_one(".", "./.", 0);
test_path_compare_one(".", "././.", 0);
test_path_compare_one("./..", ".", 1);
test_path_compare_one("x/.y", "x/y", -1);
test_path_compare_one("foo", "/foo", -1);
test_path_compare_one("/foo", "/foo/bar", -1);