mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 19:33:29 +01:00
Rename IStreamingReporterPtr => IEventListenerPtr
This reflects the renaming of the reporter/listener base class.
This commit is contained in:
parent
73d8fb5bca
commit
4e006a93ff
@ -34,14 +34,14 @@ namespace Catch {
|
||||
namespace {
|
||||
const int MaxExitCode = 255;
|
||||
|
||||
IStreamingReporterPtr createReporter(std::string const& reporterName, ReporterConfig const& config) {
|
||||
IEventListenerPtr createReporter(std::string const& reporterName, ReporterConfig const& config) {
|
||||
auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
|
||||
CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << '\'');
|
||||
|
||||
return reporter;
|
||||
}
|
||||
|
||||
IStreamingReporterPtr prepareReporters(Config const* config) {
|
||||
IEventListenerPtr prepareReporters(Config const* config) {
|
||||
if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()
|
||||
&& config->getReporterSpecs().size() == 1) {
|
||||
auto const& spec = config->getReporterSpecs()[0];
|
||||
@ -80,7 +80,7 @@ namespace Catch {
|
||||
|
||||
class TestGroup {
|
||||
public:
|
||||
explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config):
|
||||
explicit TestGroup(IEventListenerPtr&& reporter, Config const* config):
|
||||
m_reporter(reporter.get()),
|
||||
m_config{config},
|
||||
m_context{config, CATCH_MOVE(reporter)} {
|
||||
|
@ -251,7 +251,7 @@ namespace Catch {
|
||||
virtual void listTags(std::vector<TagInfo> const& tags) = 0;
|
||||
|
||||
};
|
||||
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
|
||||
using IEventListenerPtr = Detail::unique_ptr<IEventListener>;
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
@ -17,13 +17,13 @@ namespace Catch {
|
||||
struct ReporterConfig;
|
||||
struct IConfig;
|
||||
class IEventListener;
|
||||
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
|
||||
using IEventListenerPtr = Detail::unique_ptr<IEventListener>;
|
||||
|
||||
|
||||
struct IReporterFactory {
|
||||
virtual ~IReporterFactory(); // = default
|
||||
|
||||
virtual IStreamingReporterPtr
|
||||
virtual IEventListenerPtr
|
||||
create( ReporterConfig const& config ) const = 0;
|
||||
virtual std::string getDescription() const = 0;
|
||||
};
|
||||
@ -32,7 +32,7 @@ namespace Catch {
|
||||
class EventListenerFactory {
|
||||
public:
|
||||
virtual ~EventListenerFactory(); // = default
|
||||
virtual IStreamingReporterPtr create( IConfig const* config ) const = 0;
|
||||
virtual IEventListenerPtr create( IConfig const* config ) const = 0;
|
||||
virtual std::string getDescription() const = 0;
|
||||
};
|
||||
} // namespace Catch
|
||||
|
@ -20,7 +20,7 @@ namespace Catch {
|
||||
struct IConfig;
|
||||
|
||||
class IEventListener;
|
||||
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
|
||||
using IEventListenerPtr = Detail::unique_ptr<IEventListener>;
|
||||
struct IReporterFactory;
|
||||
using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
|
||||
struct ReporterConfig;
|
||||
@ -31,7 +31,7 @@ namespace Catch {
|
||||
using Listeners = std::vector<Detail::unique_ptr<EventListenerFactory>>;
|
||||
|
||||
virtual ~IReporterRegistry(); // = default
|
||||
virtual IStreamingReporterPtr create( std::string const& name, ReporterConfig const& config ) const = 0;
|
||||
virtual IEventListenerPtr create( std::string const& name, ReporterConfig const& config ) const = 0;
|
||||
virtual FactoryMap const& getFactories() const = 0;
|
||||
virtual Listeners const& getListeners() const = 0;
|
||||
};
|
||||
|
@ -37,7 +37,7 @@ namespace Catch {
|
||||
ReporterRegistry::~ReporterRegistry() = default;
|
||||
|
||||
|
||||
IStreamingReporterPtr ReporterRegistry::create( std::string const& name, ReporterConfig const& config ) const {
|
||||
IEventListenerPtr ReporterRegistry::create( std::string const& name, ReporterConfig const& config ) const {
|
||||
auto it = m_factories.find( name );
|
||||
if( it == m_factories.end() )
|
||||
return nullptr;
|
||||
|
@ -21,7 +21,7 @@ namespace Catch {
|
||||
ReporterRegistry();
|
||||
~ReporterRegistry() override; // = default, out of line to allow fwd decl
|
||||
|
||||
IStreamingReporterPtr create( std::string const& name, ReporterConfig const& config ) const override;
|
||||
IEventListenerPtr create( std::string const& name, ReporterConfig const& config ) const override;
|
||||
|
||||
void registerReporter( std::string const& name, IReporterFactoryPtr factory );
|
||||
void registerListener( Detail::unique_ptr<EventListenerFactory> factory );
|
||||
|
@ -160,7 +160,7 @@ namespace Catch {
|
||||
GeneratorTracker::~GeneratorTracker() = default;
|
||||
}
|
||||
|
||||
RunContext::RunContext(IConfig const* _config, IStreamingReporterPtr&& reporter)
|
||||
RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter)
|
||||
: m_runInfo(_config->name()),
|
||||
m_context(getCurrentMutableContext()),
|
||||
m_config(_config),
|
||||
|
@ -36,7 +36,7 @@ namespace Catch {
|
||||
RunContext( RunContext const& ) = delete;
|
||||
RunContext& operator =( RunContext const& ) = delete;
|
||||
|
||||
explicit RunContext( IConfig const* _config, IStreamingReporterPtr&& reporter );
|
||||
explicit RunContext( IConfig const* _config, IEventListenerPtr&& reporter );
|
||||
|
||||
~RunContext() override;
|
||||
|
||||
@ -130,7 +130,7 @@ namespace Catch {
|
||||
|
||||
IConfig const* m_config;
|
||||
Totals m_totals;
|
||||
IStreamingReporterPtr m_reporter;
|
||||
IEventListenerPtr m_reporter;
|
||||
std::vector<MessageInfo> m_messages;
|
||||
std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped messages. */
|
||||
AssertionInfo m_lastAssertionInfo;
|
||||
|
@ -21,13 +21,13 @@ namespace Catch {
|
||||
reporterish.getPreferences().shouldReportAllAssertions;
|
||||
}
|
||||
|
||||
void MultiReporter::addListener( IStreamingReporterPtr&& listener ) {
|
||||
void MultiReporter::addListener( IEventListenerPtr&& listener ) {
|
||||
updatePreferences(*listener);
|
||||
m_reporterLikes.insert(m_reporterLikes.begin() + m_insertedListeners, CATCH_MOVE(listener) );
|
||||
++m_insertedListeners;
|
||||
}
|
||||
|
||||
void MultiReporter::addReporter( IStreamingReporterPtr&& reporter ) {
|
||||
void MultiReporter::addReporter( IEventListenerPtr&& reporter ) {
|
||||
updatePreferences(*reporter);
|
||||
|
||||
// We will need to output the captured stdout if there are reporters
|
||||
|
@ -19,7 +19,7 @@ namespace Catch {
|
||||
* All Listeners are stored before all reporters, and individual
|
||||
* listeners/reporters are stored in order of insertion.
|
||||
*/
|
||||
std::vector<IStreamingReporterPtr> m_reporterLikes;
|
||||
std::vector<IEventListenerPtr> m_reporterLikes;
|
||||
bool m_haveNoncapturingReporters = false;
|
||||
|
||||
// Keep track of how many listeners we have already inserted,
|
||||
@ -33,8 +33,8 @@ namespace Catch {
|
||||
IEventListener( config )
|
||||
{}
|
||||
|
||||
void addListener( IStreamingReporterPtr&& listener );
|
||||
void addReporter( IStreamingReporterPtr&& reporter );
|
||||
void addListener( IEventListenerPtr&& listener );
|
||||
void addReporter( IEventListenerPtr&& reporter );
|
||||
|
||||
public: // IEventListener
|
||||
|
||||
|
@ -17,12 +17,12 @@
|
||||
namespace Catch {
|
||||
|
||||
class IEventListener;
|
||||
using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
|
||||
using IEventListenerPtr = Detail::unique_ptr<IEventListener>;
|
||||
|
||||
template <typename T>
|
||||
class ReporterFactory : public IReporterFactory {
|
||||
|
||||
IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
||||
IEventListenerPtr create( ReporterConfig const& config ) const override {
|
||||
return Detail::make_unique<T>( config );
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Catch {
|
||||
|
||||
class TypedListenerFactory : public EventListenerFactory {
|
||||
|
||||
IStreamingReporterPtr
|
||||
IEventListenerPtr
|
||||
create( IConfig const* config ) const override {
|
||||
return Detail::make_unique<T>(config);
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ TEST_CASE("Multireporter updates ReporterPreferences properly",
|
||||
|
||||
namespace {
|
||||
class TestReporterFactory : public Catch::IReporterFactory {
|
||||
Catch::IStreamingReporterPtr create( Catch::ReporterConfig const& ) const override {
|
||||
Catch::IEventListenerPtr create( Catch::ReporterConfig const& ) const override {
|
||||
CATCH_INTERNAL_ERROR(
|
||||
"This factory should never create a reporter" );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user