mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Make benchmark* and fatalError reporter events pure virtual
This commit is contained in:
parent
f314fa1f8c
commit
785436cd74
@ -81,6 +81,6 @@ namespace Catch {
|
|||||||
aborting( _aborting )
|
aborting( _aborting )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void IStreamingReporter::fatalErrorEncountered( StringRef ) {}
|
IStreamingReporter::~IStreamingReporter() = default;
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
@ -162,7 +162,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
IStreamingReporter( IConfig const* config ): m_config( config ) {}
|
IStreamingReporter( IConfig const* config ): m_config( config ) {}
|
||||||
|
|
||||||
virtual ~IStreamingReporter() = default;
|
virtual ~IStreamingReporter(); // = default;
|
||||||
|
|
||||||
// Implementing class must also provide the following static methods:
|
// Implementing class must also provide the following static methods:
|
||||||
// static std::string getDescription();
|
// static std::string getDescription();
|
||||||
@ -182,10 +182,10 @@ namespace Catch {
|
|||||||
virtual void testCasePartialStarting( TestCaseInfo const& testInfo, uint64_t partNumber ) = 0;
|
virtual void testCasePartialStarting( TestCaseInfo const& testInfo, uint64_t partNumber ) = 0;
|
||||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
|
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
|
||||||
|
|
||||||
virtual void benchmarkPreparing( StringRef ) {}
|
virtual void benchmarkPreparing( StringRef benchmarkName ) = 0;
|
||||||
virtual void benchmarkStarting( BenchmarkInfo const& ) {}
|
virtual void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) = 0;
|
||||||
virtual void benchmarkEnded( BenchmarkStats<> const& ) {}
|
virtual void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) = 0;
|
||||||
virtual void benchmarkFailed( StringRef ) {}
|
virtual void benchmarkFailed( StringRef benchmarkName ) = 0;
|
||||||
|
|
||||||
virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
|
virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
|
||||||
|
|
||||||
@ -200,8 +200,7 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
|
virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
|
||||||
|
|
||||||
// Default empty implementation provided
|
virtual void fatalErrorEncountered( StringRef error ) = 0;
|
||||||
virtual void fatalErrorEncountered( StringRef name );
|
|
||||||
|
|
||||||
//! Writes out information about provided reporters using reporter-specific format
|
//! Writes out information about provided reporters using reporter-specific format
|
||||||
virtual void listReporters(std::vector<ReporterDescription> const& descriptions) = 0;
|
virtual void listReporters(std::vector<ReporterDescription> const& descriptions) = 0;
|
||||||
|
@ -220,6 +220,14 @@ namespace Catch {
|
|||||||
#include <catch2/reporters/catch_reporter_event_listener.hpp>
|
#include <catch2/reporters/catch_reporter_event_listener.hpp>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
void EventListenerBase::fatalErrorEncountered( StringRef ) {}
|
||||||
|
|
||||||
|
void EventListenerBase::benchmarkPreparing( StringRef ) {}
|
||||||
|
void EventListenerBase::benchmarkStarting( BenchmarkInfo const& ) {}
|
||||||
|
void EventListenerBase::benchmarkEnded( BenchmarkStats<> const& ) {}
|
||||||
|
void EventListenerBase::benchmarkFailed( StringRef ) {}
|
||||||
|
|
||||||
void EventListenerBase::assertionStarting( AssertionInfo const& ) {}
|
void EventListenerBase::assertionStarting( AssertionInfo const& ) {}
|
||||||
|
|
||||||
void EventListenerBase::assertionEnded( AssertionStats const& ) {}
|
void EventListenerBase::assertionEnded( AssertionStats const& ) {}
|
||||||
|
@ -49,9 +49,14 @@ namespace Catch {
|
|||||||
stream( _config.stream() ) {}
|
stream( _config.stream() ) {}
|
||||||
~CumulativeReporterBase() override;
|
~CumulativeReporterBase() override;
|
||||||
|
|
||||||
|
void benchmarkPreparing( StringRef ) override {}
|
||||||
|
void benchmarkStarting( BenchmarkInfo const& ) override {}
|
||||||
|
void benchmarkEnded( BenchmarkStats<> const& ) override {}
|
||||||
|
void benchmarkFailed( StringRef ) override {}
|
||||||
|
|
||||||
void noMatchingTestCases( StringRef ) override {}
|
void noMatchingTestCases( StringRef ) override {}
|
||||||
void reportInvalidArguments( StringRef ) override {}
|
void reportInvalidArguments( StringRef ) override {}
|
||||||
|
void fatalErrorEncountered( StringRef /*error*/ ) override {}
|
||||||
|
|
||||||
|
|
||||||
void testRunStarting( TestRunInfo const& ) override {}
|
void testRunStarting( TestRunInfo const& ) override {}
|
||||||
|
@ -15,7 +15,7 @@ namespace Catch {
|
|||||||
/**
|
/**
|
||||||
* Base class identifying listeners.
|
* Base class identifying listeners.
|
||||||
*
|
*
|
||||||
* Provides default implementation for all IStreamingReporter member
|
* Provides empty default implementation for all IStreamingReporter member
|
||||||
* functions, so that listeners implementations can pick which
|
* functions, so that listeners implementations can pick which
|
||||||
* member functions it actually cares about.
|
* member functions it actually cares about.
|
||||||
*/
|
*/
|
||||||
@ -25,6 +25,12 @@ namespace Catch {
|
|||||||
IStreamingReporter( config.fullConfig() ) {}
|
IStreamingReporter( config.fullConfig() ) {}
|
||||||
|
|
||||||
void reportInvalidArguments( StringRef unmatchedSpec ) override;
|
void reportInvalidArguments( StringRef unmatchedSpec ) override;
|
||||||
|
void fatalErrorEncountered( StringRef error ) override;
|
||||||
|
|
||||||
|
void benchmarkPreparing( StringRef name ) override;
|
||||||
|
void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
|
||||||
|
void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
|
||||||
|
void benchmarkFailed( StringRef error ) override;
|
||||||
|
|
||||||
void assertionStarting( AssertionInfo const& assertionInfo ) override;
|
void assertionStarting( AssertionInfo const& assertionInfo ) override;
|
||||||
void assertionEnded( AssertionStats const& assertionStats ) override;
|
void assertionEnded( AssertionStats const& assertionStats ) override;
|
||||||
|
@ -29,6 +29,13 @@ namespace Catch {
|
|||||||
m_reporter->noMatchingTestCases( unmatchedSpec );
|
m_reporter->noMatchingTestCases( unmatchedSpec );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ListeningReporter::fatalErrorEncountered( StringRef error ) {
|
||||||
|
for ( auto& listener : m_listeners ) {
|
||||||
|
listener->fatalErrorEncountered( error );
|
||||||
|
}
|
||||||
|
m_reporter->fatalErrorEncountered( error );
|
||||||
|
}
|
||||||
|
|
||||||
void ListeningReporter::reportInvalidArguments( StringRef arg ) {
|
void ListeningReporter::reportInvalidArguments( StringRef arg ) {
|
||||||
for ( auto& listener : m_listeners ) {
|
for ( auto& listener : m_listeners ) {
|
||||||
listener->reportInvalidArguments( arg );
|
listener->reportInvalidArguments( arg );
|
||||||
|
@ -31,7 +31,7 @@ namespace Catch {
|
|||||||
public: // IStreamingReporter
|
public: // IStreamingReporter
|
||||||
|
|
||||||
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
||||||
|
void fatalErrorEncountered( StringRef error ) override;
|
||||||
void reportInvalidArguments( StringRef arg ) override;
|
void reportInvalidArguments( StringRef arg ) override;
|
||||||
|
|
||||||
void benchmarkPreparing( StringRef name ) override;
|
void benchmarkPreparing( StringRef name ) override;
|
||||||
|
@ -42,6 +42,12 @@ namespace Catch {
|
|||||||
|
|
||||||
~StreamingReporterBase() override;
|
~StreamingReporterBase() override;
|
||||||
|
|
||||||
|
void benchmarkPreparing( StringRef ) override {}
|
||||||
|
void benchmarkStarting( BenchmarkInfo const& ) override {}
|
||||||
|
void benchmarkEnded( BenchmarkStats<> const& ) override {}
|
||||||
|
void benchmarkFailed( StringRef ) override {}
|
||||||
|
|
||||||
|
void fatalErrorEncountered( StringRef /*error*/ ) override {}
|
||||||
void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {}
|
void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {}
|
||||||
void reportInvalidArguments( StringRef /*invalidArgument*/ ) override {}
|
void reportInvalidArguments( StringRef /*invalidArgument*/ ) override {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user