From ad2f090abf668819b3a6c96fc35d25ad50e6eb1e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 18 Apr 2017 18:06:34 +0300 Subject: Add test for function urlJoin. --- src/utils/stringutils_unittest.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc index 9d3285ccc..7a303e2ac 100644 --- a/src/utils/stringutils_unittest.cc +++ b/src/utils/stringutils_unittest.cc @@ -1416,6 +1416,22 @@ TEST_CASE("stringuntils pathJoin2") "dir1" + sep + "dir2" + sep + "dir3" + sep + "dir4" + sep + "dir5"); } +TEST_CASE("stringuntils urlJoin") +{ + REQUIRE(urlJoin("", "") == "/"); + REQUIRE(urlJoin("/", "") == "/"); + REQUIRE(urlJoin("", "/") == "/"); + REQUIRE(urlJoin("/", "/") == "/"); + REQUIRE(urlJoin("dir1", "dir2") == "dir1/dir2"); + REQUIRE(urlJoin("dir1/", "dir2") == "dir1/dir2"); + REQUIRE(urlJoin("dir1", "/dir2") == "dir1/dir2"); + REQUIRE(urlJoin("dir1/", "/dir2") == "dir1/dir2"); + REQUIRE(urlJoin("dir1/dir2/dir3", "dir4") == "dir1/dir2/dir3/dir4"); + REQUIRE(urlJoin("dir1/dir2/", "dir3/dir4") == "dir1/dir2/dir3/dir4"); + REQUIRE(urlJoin("dir1/dir2", "dir3/dir4") == "dir1/dir2/dir3/dir4"); + REQUIRE(urlJoin("dir1/dir2", "/dir3/dir4") == "dir1/dir2/dir3/dir4"); +} + TEST_CASE("stringuntils secureChatCommand") { std::string str; -- cgit v1.2.3-70-g09d2