mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Rename base reporter iface IStreamingReporter -> IEventListener
This commit is contained in:
parent
f9facc1881
commit
4dd5e2eece
@ -120,7 +120,7 @@ namespace Catch {
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IStreamingReporter* m_reporter;
|
IEventListener* m_reporter;
|
||||||
Config const* m_config;
|
Config const* m_config;
|
||||||
RunContext m_context;
|
RunContext m_context;
|
||||||
std::set<TestCaseHandle const*> m_tests;
|
std::set<TestCaseHandle const*> m_tests;
|
||||||
|
@ -78,6 +78,6 @@ namespace Catch {
|
|||||||
aborting( _aborting )
|
aborting( _aborting )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
IStreamingReporter::~IStreamingReporter() = default;
|
IEventListener::~IEventListener() = default;
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
@ -150,7 +150,7 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! The common base for all reporters and event listeners
|
//! The common base for all reporters and event listeners
|
||||||
struct IStreamingReporter {
|
class IEventListener {
|
||||||
protected:
|
protected:
|
||||||
//! Derived classes can set up their preferences here
|
//! Derived classes can set up their preferences here
|
||||||
ReporterPreferences m_preferences;
|
ReporterPreferences m_preferences;
|
||||||
@ -158,9 +158,9 @@ namespace Catch {
|
|||||||
IConfig const* m_config;
|
IConfig const* m_config;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IStreamingReporter( IConfig const* config ): m_config( config ) {}
|
IEventListener( IConfig const* config ): m_config( config ) {}
|
||||||
|
|
||||||
virtual ~IStreamingReporter(); // = default;
|
virtual ~IEventListener(); // = 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();
|
||||||
@ -230,7 +230,7 @@ namespace Catch {
|
|||||||
virtual void listTags(std::vector<TagInfo> const& tags) = 0;
|
virtual void listTags(std::vector<TagInfo> const& tags) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
|
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct ReporterConfig;
|
struct ReporterConfig;
|
||||||
struct IStreamingReporter;
|
class IEventListener;
|
||||||
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
|
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
|
||||||
|
|
||||||
|
|
||||||
struct IReporterFactory {
|
struct IReporterFactory {
|
||||||
|
@ -19,8 +19,8 @@ namespace Catch {
|
|||||||
|
|
||||||
struct IConfig;
|
struct IConfig;
|
||||||
|
|
||||||
struct IStreamingReporter;
|
class IEventListener;
|
||||||
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
|
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
|
||||||
struct IReporterFactory;
|
struct IReporterFactory;
|
||||||
using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
|
using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
|
||||||
struct ReporterConfig;
|
struct ReporterConfig;
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void listTests(IStreamingReporter& reporter, IConfig const& config) {
|
void listTests(IEventListener& reporter, IConfig const& config) {
|
||||||
auto const& testSpec = config.testSpec();
|
auto const& testSpec = config.testSpec();
|
||||||
auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
||||||
reporter.listTests(matchedTestCases);
|
reporter.listTests(matchedTestCases);
|
||||||
}
|
}
|
||||||
|
|
||||||
void listTags(IStreamingReporter& reporter, IConfig const& config) {
|
void listTags(IEventListener& reporter, IConfig const& config) {
|
||||||
auto const& testSpec = config.testSpec();
|
auto const& testSpec = config.testSpec();
|
||||||
std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ namespace Catch {
|
|||||||
reporter.listTags(infos);
|
reporter.listTags(infos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void listReporters(IStreamingReporter& reporter) {
|
void listReporters(IEventListener& reporter) {
|
||||||
std::vector<ReporterDescription> descriptions;
|
std::vector<ReporterDescription> descriptions;
|
||||||
|
|
||||||
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
|
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
|
||||||
@ -86,7 +86,7 @@ namespace Catch {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool list( IStreamingReporter& reporter, Config const& config ) {
|
bool list( IEventListener& reporter, Config const& config ) {
|
||||||
bool listed = false;
|
bool listed = false;
|
||||||
if (config.listTests()) {
|
if (config.listTests()) {
|
||||||
listed = true;
|
listed = true;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct IStreamingReporter;
|
class IEventListener;
|
||||||
class Config;
|
class Config;
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ namespace Catch {
|
|||||||
std::size_t count = 0;
|
std::size_t count = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool list( IStreamingReporter& reporter, Config const& config );
|
bool list( IEventListener& reporter, Config const& config );
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace Catch {
|
|||||||
* performance. **Accessing the assertion expansions if it wasn't stored is
|
* performance. **Accessing the assertion expansions if it wasn't stored is
|
||||||
* UB.**
|
* UB.**
|
||||||
*/
|
*/
|
||||||
class CumulativeReporterBase : public IStreamingReporter {
|
class CumulativeReporterBase : public IEventListener {
|
||||||
public:
|
public:
|
||||||
template<typename T, typename ChildNodeT>
|
template<typename T, typename ChildNodeT>
|
||||||
struct Node {
|
struct Node {
|
||||||
@ -90,7 +90,7 @@ namespace Catch {
|
|||||||
using TestRunNode = Node<TestRunStats, TestCaseNode>;
|
using TestRunNode = Node<TestRunStats, TestCaseNode>;
|
||||||
|
|
||||||
CumulativeReporterBase( ReporterConfig const& _config ):
|
CumulativeReporterBase( ReporterConfig const& _config ):
|
||||||
IStreamingReporter( _config.fullConfig() ),
|
IEventListener( _config.fullConfig() ),
|
||||||
m_stream( _config.stream() ) {}
|
m_stream( _config.stream() ) {}
|
||||||
~CumulativeReporterBase() override;
|
~CumulativeReporterBase() override;
|
||||||
|
|
||||||
|
@ -13,16 +13,16 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class identifying listeners.
|
* Base class to simplify implementing listeners.
|
||||||
*
|
*
|
||||||
* Provides empty default implementation for all IStreamingReporter member
|
* Provides empty default implementation for all IEventListener member
|
||||||
* functions, so that listeners implementations can pick which
|
* functions, so that a listener implementation can pick which
|
||||||
* member functions it actually cares about.
|
* member functions it actually cares about.
|
||||||
*/
|
*/
|
||||||
class EventListenerBase : public IStreamingReporter {
|
class EventListenerBase : public IEventListener {
|
||||||
public:
|
public:
|
||||||
EventListenerBase( ReporterConfig const& config ):
|
EventListenerBase( ReporterConfig const& config ):
|
||||||
IStreamingReporter( config.fullConfig() ) {}
|
IEventListener( config.fullConfig() ) {}
|
||||||
|
|
||||||
void reportInvalidTestSpec( StringRef unmatchedSpec ) override;
|
void reportInvalidTestSpec( StringRef unmatchedSpec ) override;
|
||||||
void fatalErrorEncountered( StringRef error ) override;
|
void fatalErrorEncountered( StringRef error ) override;
|
||||||
@ -52,7 +52,6 @@ namespace Catch {
|
|||||||
void testCaseEnded( TestCaseStats const& testCaseStats ) override;
|
void testCaseEnded( TestCaseStats const& testCaseStats ) override;
|
||||||
void testRunEnded( TestRunStats const& testRunStats ) override;
|
void testRunEnded( TestRunStats const& testRunStats ) override;
|
||||||
void skipTest( TestCaseInfo const& testInfo ) override;
|
void skipTest( TestCaseInfo const& testInfo ) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
void MultiReporter::updatePreferences(IStreamingReporter const& reporterish) {
|
void MultiReporter::updatePreferences(IEventListener const& reporterish) {
|
||||||
m_preferences.shouldRedirectStdOut |=
|
m_preferences.shouldRedirectStdOut |=
|
||||||
reporterish.getPreferences().shouldRedirectStdOut;
|
reporterish.getPreferences().shouldRedirectStdOut;
|
||||||
m_preferences.shouldReportAllAssertions |=
|
m_preferences.shouldReportAllAssertions |=
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class MultiReporter final : public IStreamingReporter {
|
class MultiReporter final : public IEventListener {
|
||||||
/*
|
/*
|
||||||
* Stores all added reporters and listeners
|
* Stores all added reporters and listeners
|
||||||
*
|
*
|
||||||
@ -26,17 +26,17 @@ namespace Catch {
|
|||||||
// so that we can insert them into the main vector at the right place
|
// so that we can insert them into the main vector at the right place
|
||||||
size_t m_insertedListeners = 0;
|
size_t m_insertedListeners = 0;
|
||||||
|
|
||||||
void updatePreferences(IStreamingReporter const& reporterish);
|
void updatePreferences(IEventListener const& reporterish);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MultiReporter( IConfig const* config ):
|
MultiReporter( IConfig const* config ):
|
||||||
IStreamingReporter( config )
|
IEventListener( config )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void addListener( IStreamingReporterPtr&& listener );
|
void addListener( IStreamingReporterPtr&& listener );
|
||||||
void addReporter( IStreamingReporterPtr&& reporter );
|
void addReporter( IStreamingReporterPtr&& reporter );
|
||||||
|
|
||||||
public: // IStreamingReporter
|
public: // IEventListener
|
||||||
|
|
||||||
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
||||||
void fatalErrorEncountered( StringRef error ) override;
|
void fatalErrorEncountered( StringRef error ) override;
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct IStreamingReporter;
|
class IEventListener;
|
||||||
using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
|
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class ReporterFactory : public IReporterFactory {
|
class ReporterFactory : public IReporterFactory {
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class StreamingReporterBase : public IStreamingReporter {
|
class StreamingReporterBase : public IEventListener {
|
||||||
public:
|
public:
|
||||||
StreamingReporterBase( ReporterConfig const& _config ):
|
StreamingReporterBase( ReporterConfig const& _config ):
|
||||||
IStreamingReporter( _config.fullConfig() ),
|
IEventListener( _config.fullConfig() ),
|
||||||
m_stream( _config.stream() ) {}
|
m_stream( _config.stream() ) {}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user