6namespace CppSpec::Matchers {
10 { t.error() } -> std::same_as<typename T::error_type&>;
14class HaveError :
public MatcherBase<T, void*> {
16 HaveError(
Expectation<T>& expectation) : MatcherBase<T, void*>(expectation) {}
18 std::string verb()
override {
return "have an error"; }
21 bool match()
override {
return (!this->actual().has_value()); }
24template <expected T,
typename E>
25class HaveErrorEqualTo :
public MatcherBase<T, E> {
27 static_assert(std::is_same_v<typename T::error_type, E>,
"the contained error_type must match the expected type");
30 bool match() {
return (this->actual().error() == this->expected()); }
Wraps the target of an expectation.
Definition expectation.hpp:47
std::string description() override
Get the description of the Matcher.
Definition have_error.hpp:19
Definition have_error.hpp:9
Contains the base class for all Matchers.