summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-18 18:06:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-18 18:06:34 +0300
commitad2f090abf668819b3a6c96fc35d25ad50e6eb1e (patch)
tree481600eaf05845c4673170d7e83878ff5bc3a3da
parent630f0815458c8cbc8f702e12b92153000fd32bcc (diff)
downloadplus-ad2f090abf668819b3a6c96fc35d25ad50e6eb1e.tar.gz
plus-ad2f090abf668819b3a6c96fc35d25ad50e6eb1e.tar.bz2
plus-ad2f090abf668819b3a6c96fc35d25ad50e6eb1e.tar.xz
plus-ad2f090abf668819b3a6c96fc35d25ad50e6eb1e.zip
Add test for function urlJoin.
-rw-r--r--src/utils/stringutils_unittest.cc16
1 files changed, 16 insertions, 0 deletions
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;