Class FailureReporter

Class Documentation

class FailureReporter
[source]

Sink for mock failures; reports them through the test framework.

The default implementation forwards failures to the current test::Shell. Replace the reporter on a Support object via Support::set_mock_failure_standard_reporter() to intercept or silence mock failures in tests that verify the mock layer itself.

Public Functions

FailureReporter() = default
[source]
virtual ~FailureReporter() = default
[source]
virtual void fail_test(Failure failure)

Report failure and exit the current test.

Parameters:

failure – The failure to report.

virtual void report_failure(const Failure &failure)

Report failure without exiting the test.

Parameters:

failure – The failure to report.

virtual void exit_test()
[source]

Exit the currently running test.

virtual test::Shell *get_test_to_fail()
[source]
Returns:

The Shell that will receive failures, or nullptr if none.

inline virtual void crash_on_failure(bool should_crash)

Control whether failures trigger a hard crash.

Parameters:

should_crash – If true, crash the process on the next failure.

Protected Attributes

bool crash_on_failure_ = {false}