Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Rename base reporter iface IStreamingReporter -> IEventListener

Commit
4dd5e2eeceaf5c65a7648373b44ef5e68490616b
Author
Martin Hořeňovský ·
Parents
f9facc188142

Files · Download .tar.gz

Changes

 src/catch2/catch_session.cpp                                 |  2 +-
 src/catch2/interfaces/catch_interfaces_reporter.cpp          |  2 +-
 src/catch2/interfaces/catch_interfaces_reporter.hpp          |  8 ++++----
 src/catch2/interfaces/catch_interfaces_reporter_factory.hpp  |  4 ++--
 src/catch2/interfaces/catch_interfaces_reporter_registry.hpp |  4 ++--
 src/catch2/internal/catch_list.cpp                           |  8 ++++----
 src/catch2/internal/catch_list.hpp                           |  4 ++--
 src/catch2/reporters/catch_reporter_cumulative_base.hpp      |  4 ++--
 src/catch2/reporters/catch_reporter_event_listener.hpp       | 11 +++++------
 src/catch2/reporters/catch_reporter_multi.cpp                |  2 +-
 src/catch2/reporters/catch_reporter_multi.hpp                |  8 ++++----
 src/catch2/reporters/catch_reporter_registrars.hpp           |  4 ++--
 src/catch2/reporters/catch_reporter_streaming_base.hpp       |  4 ++--
 13 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp
index 912cd850..a4a78bb6 100644
--- a/src/catch2/catch_session.cpp
+++ b/src/catch2/catch_session.cpp
@@ -120,7 +120,7 @@ namespace Catch {
 
 
         private:
-            IStreamingReporter* m_reporter;
+            IEventListener* m_reporter;
             Config const* m_config;
             RunContext m_context;
             std::set<TestCaseHandle const*> m_tests;
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp
index 5439254c..e5d3921f 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.cpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp
@@ -78,6 +78,6 @@ namespace Catch {
         aborting( _aborting )
     {}
 
-    IStreamingReporter::~IStreamingReporter() = default;
+    IEventListener::~IEventListener() = default;
 
 } // end namespace Catch
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp
index 432bc4e5..c05648b7 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.hpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp
@@ -150,7 +150,7 @@ namespace Catch {
     };
 
     //! The common base for all reporters and event listeners
-    struct IStreamingReporter {
+    class IEventListener {
     protected:
         //! Derived classes can set up their preferences here
         ReporterPreferences m_preferences;
@@ -158,9 +158,9 @@ namespace Catch {
         IConfig const* m_config;
 
     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:
         // static std::string getDescription();
@@ -230,7 +230,7 @@ namespace Catch {
         virtual void listTags(std::vector<TagInfo> const& tags) = 0;
 
     };
-    using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
+    using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
 
 } // end namespace Catch
 
diff --git a/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp b/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp
index 5a40d1bd..eb107c20 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp
@@ -15,8 +15,8 @@
 namespace Catch {
 
     struct ReporterConfig;
-    struct IStreamingReporter;
-    using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
+    class IEventListener;
+    using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
 
 
     struct IReporterFactory {
diff --git a/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp b/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp
index 582c39b4..904ffd03 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp
@@ -19,8 +19,8 @@ namespace Catch {
 
     struct IConfig;
 
-    struct IStreamingReporter;
-    using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
+    class IEventListener;
+    using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
     struct IReporterFactory;
     using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
     struct ReporterConfig;
diff --git a/src/catch2/internal/catch_list.cpp b/src/catch2/internal/catch_list.cpp
index 6d99dfb1..609d459c 100644
--- a/src/catch2/internal/catch_list.cpp
+++ b/src/catch2/internal/catch_list.cpp
@@ -23,13 +23,13 @@
 namespace Catch {
     namespace {
 
-        void listTests(IStreamingReporter& reporter, IConfig const& config) {
+        void listTests(IEventListener& reporter, IConfig const& config) {
             auto const& testSpec = config.testSpec();
             auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
             reporter.listTests(matchedTestCases);
         }
 
-        void listTags(IStreamingReporter& reporter, IConfig const& config) {
+        void listTags(IEventListener& reporter, IConfig const& config) {
             auto const& testSpec = config.testSpec();
             std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
 
@@ -51,7 +51,7 @@ namespace Catch {
             reporter.listTags(infos);
         }
 
-        void listReporters(IStreamingReporter& reporter) {
+        void listReporters(IEventListener& reporter) {
             std::vector<ReporterDescription> descriptions;
 
             IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
@@ -86,7 +86,7 @@ namespace Catch {
         return out;
     }
 
-    bool list( IStreamingReporter& reporter, Config const& config ) {
+    bool list( IEventListener& reporter, Config const& config ) {
         bool listed = false;
         if (config.listTests()) {
             listed = true;
diff --git a/src/catch2/internal/catch_list.hpp b/src/catch2/internal/catch_list.hpp
index 2d1952c5..9caf4cf6 100644
--- a/src/catch2/internal/catch_list.hpp
+++ b/src/catch2/internal/catch_list.hpp
@@ -16,7 +16,7 @@
 
 namespace Catch {
 
-    struct IStreamingReporter;
+    class IEventListener;
     class Config;
 
 
@@ -32,7 +32,7 @@ namespace Catch {
         std::size_t count = 0;
     };
 
-    bool list( IStreamingReporter& reporter, Config const& config );
+    bool list( IEventListener& reporter, Config const& config );
 
 } // end namespace Catch
 
diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/src/catch2/reporters/catch_reporter_cumulative_base.hpp
index 685c9776..974797c5 100644
--- a/src/catch2/reporters/catch_reporter_cumulative_base.hpp
+++ b/src/catch2/reporters/catch_reporter_cumulative_base.hpp
@@ -59,7 +59,7 @@ namespace Catch {
      * performance. **Accessing the assertion expansions if it wasn't stored is
      * UB.**
      */
-    class CumulativeReporterBase : public IStreamingReporter {
+    class CumulativeReporterBase : public IEventListener {
     public:
         template<typename T, typename ChildNodeT>
         struct Node {
@@ -90,7 +90,7 @@ namespace Catch {
         using TestRunNode = Node<TestRunStats, TestCaseNode>;
 
         CumulativeReporterBase( ReporterConfig const& _config ):
-            IStreamingReporter( _config.fullConfig() ),
+            IEventListener( _config.fullConfig() ),
             m_stream( _config.stream() ) {}
         ~CumulativeReporterBase() override;
 
diff --git a/src/catch2/reporters/catch_reporter_event_listener.hpp b/src/catch2/reporters/catch_reporter_event_listener.hpp
index 1df7626c..bf007c63 100644
--- a/src/catch2/reporters/catch_reporter_event_listener.hpp
+++ b/src/catch2/reporters/catch_reporter_event_listener.hpp
@@ -13,16 +13,16 @@
 namespace Catch {
 
     /**
-     * Base class identifying listeners.
+     * Base class to simplify implementing listeners.
      *
-     * Provides empty default implementation for all IStreamingReporter member
-     * functions, so that listeners implementations can pick which
+     * Provides empty default implementation for all IEventListener member
+     * functions, so that a listener implementation can pick which
      * member functions it actually cares about.
      */
-    class EventListenerBase : public IStreamingReporter {
+    class EventListenerBase : public IEventListener {
     public:
         EventListenerBase( ReporterConfig const& config ):
-            IStreamingReporter( config.fullConfig() ) {}
+            IEventListener( config.fullConfig() ) {}
 
         void reportInvalidTestSpec( StringRef unmatchedSpec ) override;
         void fatalErrorEncountered( StringRef error ) override;
@@ -52,7 +52,6 @@ namespace Catch {
         void testCaseEnded( TestCaseStats const& testCaseStats ) override;
         void testRunEnded( TestRunStats const& testRunStats ) override;
         void skipTest( TestCaseInfo const& testInfo ) override;
-
     };
 
 } // end namespace Catch
diff --git a/src/catch2/reporters/catch_reporter_multi.cpp b/src/catch2/reporters/catch_reporter_multi.cpp
index 055da9fe..0e6b6040 100644
--- a/src/catch2/reporters/catch_reporter_multi.cpp
+++ b/src/catch2/reporters/catch_reporter_multi.cpp
@@ -14,7 +14,7 @@
 #include <cassert>
 
 namespace Catch {
-    void MultiReporter::updatePreferences(IStreamingReporter const& reporterish) {
+    void MultiReporter::updatePreferences(IEventListener const& reporterish) {
         m_preferences.shouldRedirectStdOut |=
             reporterish.getPreferences().shouldRedirectStdOut;
         m_preferences.shouldReportAllAssertions |=
diff --git a/src/catch2/reporters/catch_reporter_multi.hpp b/src/catch2/reporters/catch_reporter_multi.hpp
index b8599a9e..f6b51980 100644
--- a/src/catch2/reporters/catch_reporter_multi.hpp
+++ b/src/catch2/reporters/catch_reporter_multi.hpp
@@ -12,7 +12,7 @@
 
 namespace Catch {
 
-    class MultiReporter final : public IStreamingReporter {
+    class MultiReporter final : public IEventListener {
         /*
          * 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
         size_t m_insertedListeners = 0;
 
-        void updatePreferences(IStreamingReporter const& reporterish);
+        void updatePreferences(IEventListener const& reporterish);
 
     public:
         MultiReporter( IConfig const* config ):
-            IStreamingReporter( config )
+            IEventListener( config )
         {}
 
         void addListener( IStreamingReporterPtr&& listener );
         void addReporter( IStreamingReporterPtr&& reporter );
 
-    public: // IStreamingReporter
+    public: // IEventListener
 
         void noMatchingTestCases( StringRef unmatchedSpec ) override;
         void fatalErrorEncountered( StringRef error ) override;
diff --git a/src/catch2/reporters/catch_reporter_registrars.hpp b/src/catch2/reporters/catch_reporter_registrars.hpp
index adffb543..8b02e61f 100644
--- a/src/catch2/reporters/catch_reporter_registrars.hpp
+++ b/src/catch2/reporters/catch_reporter_registrars.hpp
@@ -16,8 +16,8 @@
 
 namespace Catch {
 
-    struct IStreamingReporter;
-    using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
+    class IEventListener;
+    using IStreamingReporterPtr = Detail::unique_ptr<IEventListener>;
 
     template <typename T>
     class ReporterFactory : public IReporterFactory {
diff --git a/src/catch2/reporters/catch_reporter_streaming_base.hpp b/src/catch2/reporters/catch_reporter_streaming_base.hpp
index 8f805547..1ca50f0a 100644
--- a/src/catch2/reporters/catch_reporter_streaming_base.hpp
+++ b/src/catch2/reporters/catch_reporter_streaming_base.hpp
@@ -16,10 +16,10 @@
 
 namespace Catch {
 
-    class StreamingReporterBase : public IStreamingReporter {
+    class StreamingReporterBase : public IEventListener {
     public:
         StreamingReporterBase( ReporterConfig const& _config ):
-            IStreamingReporter( _config.fullConfig() ),
+            IEventListener( _config.fullConfig() ),
             m_stream( _config.stream() ) {}