joinPaths: support adding the trailing slash

Change-Id: I8bcaf08dd17d331c4922d1242f872961631c7caa
Co-authored-by: Jan Kundrát <jan.kundrat@cesnet.cz>
diff --git a/tests/utils.cpp b/tests/utils.cpp
index a6a982b..7717480 100644
--- a/tests/utils.cpp
+++ b/tests/utils.cpp
@@ -22,4 +22,61 @@
         REQUIRE((filterByPrefix(set, "polivkax") == std::set<std::string>{}));
         REQUIRE((filterByPrefix(set, "co") == std::set<std::string>{"copak", "coze"}));
     }
+
+    SECTION("joinPaths") {
+        std::string prefix, suffix, result;
+
+        SECTION("regular") {
+            prefix = "/example:a";
+            suffix = "leaf";
+            result = "/example:a/leaf";
+        }
+
+        SECTION("no prefix - absolute path") {
+            suffix = "/example:a/leaf";
+            result = "/example:a/leaf";
+        }
+
+        SECTION("no prefix - relative path") {
+            suffix = "example:a/leaf";
+            result = "example:a/leaf";
+        }
+
+        SECTION("no suffix") {
+            prefix = "/example:a/leaf";
+            result = "/example:a/leaf";
+        }
+
+        SECTION("at root") {
+            prefix = "/";
+            suffix = "example:a";
+            result = "/example:a";
+        }
+
+        SECTION("trailing slash") {
+            prefix = "/example:a";
+            suffix = "/";
+            result = "/example:a/";
+        }
+
+        SECTION("prefix ends with slash") {
+            prefix = "/example:a/";
+            suffix = "leaf";
+            result = "/example:a/leaf";
+        }
+
+        SECTION("suffix starts with slash") {
+            prefix = "/example:a";
+            suffix = "/leaf";
+            result = "/example:a/leaf";
+        }
+
+        SECTION("slashes all the way to eleven") {
+            prefix = "/example:a/";
+            suffix = "/leaf";
+            result = "/example:a/leaf";
+        }
+
+        REQUIRE(joinPaths(prefix, suffix) == result);
+    }
 }