path-util: allow NULLs in arguments to path_join()

This removes the need to remember to put strempty() in places, thus reducing
the likelihood of a stupid mistake.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-11-30 22:21:17 +01:00
parent 62a85ee0a9
commit 652ef29887
8 changed files with 29 additions and 26 deletions
+9
View File
@@ -251,10 +251,19 @@ static void test_path_join(void) {
test_join("/c", "", "/", "c");
test_join("/", "", "/", NULL);
test_join("/a/b/c", NULL, "/a/b", "/c");
test_join("a/b/c", NULL, "a/b", "c");
test_join("/a/b/c", NULL, "/a/b", "c");
test_join("/c", NULL, "/", "c");
test_join("/", NULL, "/", NULL);
test_join("", "", NULL);
test_join("", NULL, "");
test_join("", NULL, NULL);
test_join("foo/bar", "foo", "bar");
test_join("foo/bar", "", "foo", "bar");
test_join("foo/bar", NULL, "foo", NULL, "bar");
test_join("foo/bar", "", "foo", "", "bar", "");
test_join("foo/bar", "", "", "", "", "foo", "", "", "", "bar", "", "", "");