Skip to content

Commit

Permalink
Don't return *this in expectation::with
Browse files Browse the repository at this point in the history
Chaining is done via the wrapper class not the expectation class
  • Loading branch information
Flamefire committed Feb 9, 2022
1 parent 8f84e3d commit 1b7bcfc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions include/turtle/detail/expectation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,14 @@ namespace mock { namespace detail {
void invoke(std::unique_ptr<invocation> i) { invocation_ = std::move(i); }

template<typename... Constraints>
std::enable_if_t<(arity > 0u) && sizeof...(Constraints) == arity, expectation&> with(Constraints... c)
std::enable_if_t<(arity > 0u) && sizeof...(Constraints) == arity> with(Constraints... c)
{
matcher_ = std::make_unique<single_matcher<void(Constraints...), Args...>>(c...);
return *this;
}
template<typename Constraint, std::size_t Arity = arity>
std::enable_if_t<(Arity > 1u), expectation&> with(const Constraint& c)
std::enable_if_t<(Arity > 1u)> with(const Constraint& c)
{
matcher_ = std::make_unique<multi_matcher<Constraint, Args...>>(c);
return *this;
}

void add(sequence& s)
Expand Down

0 comments on commit 1b7bcfc

Please sign in to comment.