[base] url join review fixes

This commit is contained in:
Arsentiy Milchakov 2019-07-12 22:17:51 +03:00 committed by mpimenov
parent 660ab57e7b
commit 3751d0e36f
2 changed files with 3 additions and 5 deletions

View file

@ -5,10 +5,13 @@
UNIT_TEST(Url_Join)
{
TEST_EQUAL("", base::url::Join("", ""), ());
TEST_EQUAL("omim/", base::url::Join("", "omim/"), ());
TEST_EQUAL("omim/", base::url::Join("omim/", ""), ());
TEST_EQUAL("omim/strings", base::url::Join("omim", "strings"), ());
TEST_EQUAL("omim/strings", base::url::Join("omim/", "strings"), ());
TEST_EQUAL("../../omim/strings", base::url::Join("..", "..", "omim", "strings"), ());
TEST_EQUAL("../../omim/strings", base::url::Join("../", "..", "omim/", "strings"), ());
TEST_EQUAL("omim/strings", base::url::Join("omim/", "/strings"), ());
TEST_EQUAL("../../omim/strings", base::url::Join("../", "/../", "/omim/", "/strings"), ());
TEST_EQUAL("../omim/strings", base::url::Join("../", "", "/omim/", "/strings"), ());
}

View file

@ -27,11 +27,6 @@ std::string Join(std::string const & lhs, std::string const & rhs);
template <typename... Args>
std::string Join(std::string const & lhs, std::string const & rhs, Args &&... args)
{
if (lhs.empty())
return Join(rhs, std::forward<Args>(args)...);
if (rhs.empty())
return Join(lhs, std::forward<Args>(args)...);
return Join(Join(lhs, rhs), std::forward<Args>(args)...);
}
} // namespace url