From 3751d0e36f64c4a521c5c7bb0e5dd91c97fdbf9a Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Fri, 12 Jul 2019 22:17:51 +0300 Subject: [PATCH] [base] url join review fixes --- base/base_tests/url_helpers_tests.cpp | 3 +++ base/url_helpers.hpp | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/base/base_tests/url_helpers_tests.cpp b/base/base_tests/url_helpers_tests.cpp index dead198d4e..6739eb5b34 100644 --- a/base/base_tests/url_helpers_tests.cpp +++ b/base/base_tests/url_helpers_tests.cpp @@ -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"), ()); } diff --git a/base/url_helpers.hpp b/base/url_helpers.hpp index 466cf4e913..9c0e09beef 100644 --- a/base/url_helpers.hpp +++ b/base/url_helpers.hpp @@ -27,11 +27,6 @@ std::string Join(std::string const & lhs, std::string const & rhs); template std::string Join(std::string const & lhs, std::string const & rhs, Args &&... args) { - if (lhs.empty()) - return Join(rhs, std::forward(args)...); - if (rhs.empty()) - return Join(lhs, std::forward(args)...); - return Join(Join(lhs, rhs), std::forward(args)...); } } // namespace url