6#ifndef MIMICPP_REPORTING_DEFAULT_REPORTER_HPP
7#define MIMICPP_REPORTING_DEFAULT_REPORTER_HPP
20#ifndef MIMICPP_DETAIL_IS_MODULE
30 template <
typename Data = std::
nullptr_t>
32 :
public std::logic_error
37 std::string
const& what,
40 : std::logic_error{what},
41 m_Data{std::move(
data)},
47 Data
const&
data() const noexcept
78 : m_Out{std::addressof(out)}
88 *m_Out << msg <<
'\n';
101 *m_Out << msg <<
'\n';
109 [[maybe_unused]]
MatchReport const match)
noexcept override
111 MIMICPP_ASSERT(std::holds_alternative<state_applicable>(match.expectationReport.controlReport),
"Report denotes inapplicable expectation.");
116 if (0 == std::uncaught_exceptions())
121 *m_Out << msg <<
'\n';
130 if (0 == std::uncaught_exceptions())
134 *m_Out << message <<
'\n';
137 throw Error{message};
144 const std::exception_ptr exception)
override
154 std::ostream* m_Out{};
#define MIMICPP_ASSERT(condition, msg)
Definition Config.hpp:54
#define MIMICPP_DETAIL_MODULE_EXPORT
Definition Config.hpp:19
Contains the extracted info from a typed call::Info.
Definition CallReport.hpp:43
void report_no_matches(CallReport call, std::vector< MatchReport > noMatchReports) override
Expects reports on all non-matching expectations. This is only called when no better options are avai...
Definition DefaultReporter.hpp:83
void report_unhandled_exception(const CallReport call, const ExpectationReport expectationReport, const std::exception_ptr exception) override
Handles reports about unhandled exceptions during handle_call.
Definition DefaultReporter.hpp:141
DefaultReporter(std::ostream &out) noexcept
Definition DefaultReporter.hpp:77
void report_inapplicable_matches(CallReport call, std::vector< MatchReport > reports) override
Handles reports for all inapplicable but otherwise matching expectations. This function is called onl...
Definition DefaultReporter.hpp:95
DefaultReporter()=default
void report_full_match(CallReport const call, MatchReport const match) noexcept override
Handles the report for a fully matching expectation.
Definition DefaultReporter.hpp:107
void report_unfulfilled_expectation(ExpectationReport expectationReport) override
Handles the report of an unfulfilled expectation.
Definition DefaultReporter.hpp:114
void report_error(const StringT message) override
Handles general or unspecified errors.
Definition DefaultReporter.hpp:128
Definition DefaultReporter.hpp:33
Error(std::string const &what, Data &&data={}, util::SourceLocation loc={})
Definition DefaultReporter.hpp:36
CallReport const & data() const noexcept
Definition DefaultReporter.hpp:47
util::SourceLocation const & where() const noexcept
Definition DefaultReporter.hpp:53
Contains the extracted info from a typed expectation.
Definition ExpectationReport.hpp:85
Contains the expectation-report and the match-results to a specific call.
Definition MatchReport.hpp:22
A thin wrapper around general source-location info.
Definition SourceLocation.hpp:33
Definition BasicReporter.hpp:26
StringT stringify_unhandled_exception(CallReport const &call, ExpectationReport const &expectationReport, std::exception_ptr const &exception)
Definition StringifyReports.hpp:471
Error< ExpectationReport > UnfulfilledExpectationT
Definition DefaultReporter.hpp:64
StringT stringify_unfulfilled_expectation(ExpectationReport const &expectationReport)
Definition StringifyReports.hpp:455
StringT stringify_inapplicable_matches(CallReport const &call, std::span< MatchReport > reports)
Definition StringifyReports.hpp:354
Error< CallReport > UnmatchedCallT
Definition DefaultReporter.hpp:63
StringT stringify_no_matches(CallReport const &call, std::span< MatchReport > noMatchReports)
Definition StringifyReports.hpp:394
std::basic_string< CharT, CharTraitsT > StringT
Definition Fwd.hpp:397