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