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

IStreamingReporter is now the default. Use REGISTER_LEGACY_REPORTER to register… you guessed it: legacy reporters

The built-in reporters are still legacy at the moment.
Commit
8255acf88fa86e1e7d80ab48d7ee1d1c8b05b57a
Author
Phil Nash ·
Parents
4e12e12c1f60

Files · Download .tar.gz

Changes

 include/catch.hpp                              |  2 ++
 include/internal/catch_impl.hpp                |  6 +++---
 include/internal/catch_reporter_registrars.hpp | 15 +++++++++++++--
 projects/SelfTest/catch_self_test.cpp          |  2 +-
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/include/catch.hpp b/include/catch.hpp
index 54acd738..6fb0fd10 100644
--- a/include/catch.hpp
+++ b/include/catch.hpp
@@ -84,6 +84,7 @@
 #define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
 
 #define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
+#define CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
 
 #define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
 
@@ -126,6 +127,7 @@
 #define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
 
 #define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
+#define REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
 
 #define GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
 
diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp
index 295bf773..014a6345 100644
--- a/include/internal/catch_impl.hpp
+++ b/include/internal/catch_impl.hpp
@@ -76,9 +76,9 @@ namespace Catch {
 
     void Config::dummy() {}
 
-    INTERNAL_CATCH_REGISTER_REPORTER( "basic", BasicReporter )
-    INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
-    INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
+    INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "basic", BasicReporter )
+    INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "xml", XmlReporter )
+    INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "junit", JunitReporter )
 
 }
 
diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp
index 77ed5374..3496999f 100644
--- a/include/internal/catch_reporter_registrars.hpp
+++ b/include/internal/catch_reporter_registrars.hpp
@@ -38,6 +38,17 @@ namespace Catch {
 
         class ReporterFactory : public IReporterFactory {
 
+            // *** Please Note ***:
+            // - If you end up here looking at a compiler error because it's trying to register
+            // your custom reporter class be aware that the native reporter interface has changed
+            // to IStreamingReporter. The "legacy" interface, IReporter, is still supported via
+            // an adapter. Just use REGISTER_LEGACY_REPORTER to take advantage of the adapter.
+            // However please consider updating to the new interface as the old one is now
+            // deprecated and will probably be removed quite soon!
+            // Please contact me via github if you have any questions at all about this.
+            // In fact, ideally, please contact me anyway to let me know you've hit this - as I have
+            // no idea who is actually using custom reporters at all (possibly no-one!).
+            // The new interface is designed to minimise exposure to interface changes in the future.
             virtual IStreamingReporter* create( const ReporterConfig& config ) const {
                 return new T( config );
             }
@@ -55,9 +66,9 @@ namespace Catch {
     }; 
 }
 
-#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
+#define INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) \
     Catch::LegacyReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
-#define INTERNAL_CATCH_REGISTER_REPORTER2( name, reporterType ) \
+#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
     Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
 
 #endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
diff --git a/projects/SelfTest/catch_self_test.cpp b/projects/SelfTest/catch_self_test.cpp
index 3182b884..f2bfb8db 100644
--- a/projects/SelfTest/catch_self_test.cpp
+++ b/projects/SelfTest/catch_self_test.cpp
@@ -106,6 +106,6 @@ namespace Catch{
     const std::string MockReporter::recordTestCases = "[tc]";
     const std::string MockReporter::recordSections =" [s]";
     
-    INTERNAL_CATCH_REGISTER_REPORTER( "mock", MockReporter )
+    INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "mock", MockReporter )
     
 }