]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-path-util: check that dot components are irrelevant for path comparisons
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 23 Jun 2021 14:05:47 +0000 (16:05 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 23 Jun 2021 16:11:49 +0000 (18:11 +0200)
src/test/test-path-util.c

index 50aacdb96736f4a9647d971110cc131a8a8f55bb..4c041cd57f9d31cfd83219c3c23ffdb637974f66 100644 (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);