From: Zbigniew Jędrzejewski-Szmek Date: Wed, 23 Jun 2021 14:05:47 +0000 (+0200) Subject: test-path-util: check that dot components are irrelevant for path comparisons X-Git-Tag: v249-rc2~18^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d216bdd07995f35139fa03829ae05a83a15c281;p=thirdparty%2Fsystemd.git test-path-util: check that dot components are irrelevant for path comparisons --- diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index 50aacdb9673..4c041cd57f9 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -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);