Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-03-14 15:04:42 +0100
committerMartin Hořeňovský2022-03-18 00:36:18 +0100
commit4acc520f763f7a104d11d57afb8d3bab0bfa6ebc (patch)
tree4bcbf287b1db41c6d8608905ca82471545517992 /tests/SelfTest
parent18c58667d780bfdc82d0e52d6ac6afc462e28f47 (diff)
downloadcatch3-4acc520f763f7a104d11d57afb8d3bab0bfa6ebc.tar.gz
Event listeners no longer take reporter config in constructor
This also required splitting out Listener factory from the reporter factory hierarchy. In return, the listener factories only need to take in `IConfig const*`, which opens up further refactorings down the road in the colour selection and implementation.
Diffstat (limited to 'tests/SelfTest')
-rw-r--r--tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp18
-rw-r--r--tests/SelfTest/TestRegistrations.cpp2
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
index dcb186b6..34afc1a2 100644
--- a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
@@ -143,7 +143,7 @@ namespace {
public:
MockListener( std::string witness,
std::vector<std::string>& recorder,
- Catch::ReporterConfig const& config ):
+ Catch::IConfig const* config ):
EventListenerBase( config ),
m_witness( witness ),
m_recorder( recorder )
@@ -187,10 +187,10 @@ TEST_CASE("Multireporter calls reporters and listeners in correct order",
std::vector<std::string> records;
multiReporter.addReporter( Catch::Detail::make_unique<MockReporter>(
"Goodbye", records, rep_config ) );
- multiReporter.addListener( Catch::Detail::make_unique<MockListener>(
- "Hello", records, rep_config ) );
- multiReporter.addListener( Catch::Detail::make_unique<MockListener>(
- "world", records, rep_config ) );
+ multiReporter.addListener(
+ Catch::Detail::make_unique<MockListener>( "Hello", records, &config ) );
+ multiReporter.addListener(
+ Catch::Detail::make_unique<MockListener>( "world", records, &config ) );
multiReporter.addReporter( Catch::Detail::make_unique<MockReporter>(
"world", records, rep_config ) );
multiReporter.testRunStarting( { "" } );
@@ -206,7 +206,7 @@ namespace {
public:
PreferenceListener( bool redirectStdout,
bool reportAllAssertions,
- Catch::ReporterConfig const& config ):
+ Catch::IConfig const* config ):
EventListenerBase( config ) {
m_preferences.shouldRedirectStdOut = redirectStdout;
m_preferences.shouldReportAllAssertions = reportAllAssertions;
@@ -242,19 +242,19 @@ TEST_CASE("Multireporter updates ReporterPreferences properly",
SECTION( "Adding listeners" ) {
multiReporter.addListener(
Catch::Detail::make_unique<PreferenceListener>(
- true, false, rep_config ) );
+ true, false, &config ) );
REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true );
REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == false );
multiReporter.addListener(
Catch::Detail::make_unique<PreferenceListener>(
- false, true, rep_config ) );
+ false, true, &config ) );
REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true );
REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true);
multiReporter.addListener(
Catch::Detail::make_unique<PreferenceListener>(
- false, false, rep_config ) );
+ false, false, &config ) );
REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == true );
REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true );
}
diff --git a/tests/SelfTest/TestRegistrations.cpp b/tests/SelfTest/TestRegistrations.cpp
index 2b28c379..2586ffab 100644
--- a/tests/SelfTest/TestRegistrations.cpp
+++ b/tests/SelfTest/TestRegistrations.cpp
@@ -48,7 +48,7 @@ class ValidatingTestListener : public Catch::EventListenerBase {
};
public:
- ValidatingTestListener(Catch::ReporterConfig const& config) :
+ ValidatingTestListener(Catch::IConfig const* config) :
EventListenerBase(config) {
m_preferences.shouldReportAllAssertions = true;
}