Skip to content

Commit

Permalink
re-add empty, for nodiscard
Browse files Browse the repository at this point in the history
  • Loading branch information
rehdi93 committed Nov 1, 2020
1 parent 75713a5 commit 6b992d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions include/red/sessions/session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ namespace detail {
return ranges::distance(begin(), end());
}

[[nodiscard]]
bool empty() const noexcept { return base::empty(); }

template <class K, meta::is_strview_convertible<K> = true>
void erase(K const& key) { do_erase(key); }

Expand Down
7 changes: 4 additions & 3 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@ TEST_CASE("get environment variables", "[environment]")
{
test_vars_guard _;

REQUIRE_FALSE(environment.empty());

SECTION("operator[]")
{
for(auto[key, value] : TEST_VARS)
{
string envvalue = environment[key];
REQUIRE(envvalue == value);
REQUIRE(string(environment[key]) == value);
}

REQUIRE(environment["nonesuch"].operator std::string().empty());
REQUIRE(string(environment["nonesuch"]).empty());
}
SECTION("find()")
{
Expand Down

0 comments on commit 6b992d4

Please sign in to comment.