Don't return *this in expectation::with

Chaining is done via the wrapper class not the expectation class
This commit is contained in:
Alexander Grund 2022-02-08 18:27:46 +01:00
parent 3845d57531
commit c8c6af273e
No known key found for this signature in database
GPG key ID: AA48A0760367A42B

View file

@ -123,16 +123,14 @@ namespace mock { namespace detail {
void invoke(std::unique_ptr<invocation> i) { invocation_ = std::move(i); } void invoke(std::unique_ptr<invocation> i) { invocation_ = std::move(i); }
template<typename... Constraints> 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...); matcher_ = std::make_unique<single_matcher<void(Constraints...), Args...>>(c...);
return *this;
} }
template<typename Constraint, std::size_t Arity = arity> 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); matcher_ = std::make_unique<multi_matcher<Constraint, Args...>>(c);
return *this;
} }
void add(sequence& s) void add(sequence& s)