commit f5042711eaa1aaaedab96a55fbfff4a0994a69eb
parent 078663b80402ef2957a283d0b7b0175107c29be6
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 4 Jan 2016 11:39:00 -0500
remove Remote::hasUrl
Diffstat:
3 files changed, 1 insertion(+), 15 deletions(-)
diff --git a/src/remote.cpp b/src/remote.cpp
@@ -162,13 +162,3 @@ Remote RemoteList::get(const string &name) const
else
return it->second;
}
-
-bool RemoteList::hasUrl(const string &url) const
-{
- for(const Remote &r : m_remotes | boost::adaptors::map_values) {
- if(r.url() == url)
- return true;
- }
-
- return false;
-}
diff --git a/src/remote.hpp b/src/remote.hpp
@@ -76,7 +76,6 @@ public:
size_t size() const { return m_remotes.size(); }
bool hasName(const std::string &name) const
{ return m_remotes.count(name) > 0; }
- bool hasUrl(const std::string &url) const;
auto begin() const -> decltype(boost::adaptors::values(m_remotes).begin())
{ return boost::adaptors::values(m_remotes).begin(); }
diff --git a/test/remote.cpp b/test/remote.cpp
@@ -111,14 +111,12 @@ TEST_CASE("add remotes to list", M) {
REQUIRE(list.empty());
REQUIRE(list.size() == 0);
REQUIRE_FALSE(list.hasName("name"));
- REQUIRE_FALSE(list.hasUrl("url"));
list.add({"name", "url"});
REQUIRE_FALSE(list.empty());
REQUIRE(list.size() == 1);
REQUIRE(list.hasName("name"));
- REQUIRE(list.hasUrl("url"));
}
TEST_CASE("add invalid remote to list", M) {
@@ -135,8 +133,7 @@ TEST_CASE("replace remote", M) {
list.add({"name", "url2"});
REQUIRE(list.size() == 1);
- REQUIRE_FALSE(list.hasUrl("url1"));
- REQUIRE(list.hasUrl("url2"));
+ REQUIRE(list.get("name").url() == "url2");
};
TEST_CASE("get remote by name", M) {