From 103cb16696b7972e4f53aacea87f522ba63d2d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 4 Jan 2022 21:48:20 +0100 Subject: [PATCH] Rename listening reporter to multi reporter --- src/CMakeLists.txt | 4 +- src/catch2/catch_session.cpp | 4 +- ...listening.cpp => catch_reporter_multi.cpp} | 50 +++++++++---------- ...listening.hpp => catch_reporter_multi.hpp} | 10 ++-- src/catch2/reporters/catch_reporters_all.hpp | 2 +- .../IntrospectiveTests/Reporters.tests.cpp | 6 +-- 6 files changed, 38 insertions(+), 38 deletions(-) rename src/catch2/reporters/{catch_reporter_listening.cpp => catch_reporter_multi.cpp} (72%) rename src/catch2/reporters/{catch_reporter_listening.hpp => catch_reporter_multi.hpp} (91%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 93da8c26..c23c4735 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -217,7 +217,7 @@ set(REPORTER_HEADERS ${SOURCES_DIR}/reporters/catch_reporter_event_listener.hpp ${SOURCES_DIR}/reporters/catch_reporter_helpers.hpp ${SOURCES_DIR}/reporters/catch_reporter_junit.hpp - ${SOURCES_DIR}/reporters/catch_reporter_listening.hpp + ${SOURCES_DIR}/reporters/catch_reporter_multi.hpp ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.hpp ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.hpp ${SOURCES_DIR}/reporters/catch_reporter_tap.hpp @@ -231,7 +231,7 @@ set(REPORTER_SOURCES ${SOURCES_DIR}/reporters/catch_reporter_console.cpp ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.cpp ${SOURCES_DIR}/reporters/catch_reporter_junit.cpp - ${SOURCES_DIR}/reporters/catch_reporter_listening.cpp + ${SOURCES_DIR}/reporters/catch_reporter_multi.cpp ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.cpp ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.cpp ${SOURCES_DIR}/reporters/catch_reporter_tap.cpp diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index 2325bf2f..5671e831 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ namespace Catch { return createReporter(config->getReportersAndOutputFiles()[0].reporterName, ReporterConfig(config, stream)); } - auto multi = Detail::make_unique(config); + auto multi = Detail::make_unique(config); auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); for (auto const& listener : listeners) { diff --git a/src/catch2/reporters/catch_reporter_listening.cpp b/src/catch2/reporters/catch_reporter_multi.cpp similarity index 72% rename from src/catch2/reporters/catch_reporter_listening.cpp rename to src/catch2/reporters/catch_reporter_multi.cpp index e89090fb..055da9fe 100644 --- a/src/catch2/reporters/catch_reporter_listening.cpp +++ b/src/catch2/reporters/catch_reporter_multi.cpp @@ -5,7 +5,7 @@ // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -#include +#include #include #include @@ -14,20 +14,20 @@ #include namespace Catch { - void ListeningReporter::updatePreferences(IStreamingReporter const& reporterish) { + void MultiReporter::updatePreferences(IStreamingReporter const& reporterish) { m_preferences.shouldRedirectStdOut |= reporterish.getPreferences().shouldRedirectStdOut; m_preferences.shouldReportAllAssertions |= reporterish.getPreferences().shouldReportAllAssertions; } - void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { + void MultiReporter::addListener( IStreamingReporterPtr&& listener ) { updatePreferences(*listener); m_reporterLikes.insert(m_reporterLikes.begin() + m_insertedListeners, CATCH_MOVE(listener) ); ++m_insertedListeners; } - void ListeningReporter::addReporter( IStreamingReporterPtr&& reporter ) { + void MultiReporter::addReporter( IStreamingReporterPtr&& reporter ) { updatePreferences(*reporter); // We will need to output the captured stdout if there are reporters @@ -42,80 +42,80 @@ namespace Catch { m_reporterLikes.push_back( CATCH_MOVE( reporter ) ); } - void ListeningReporter::noMatchingTestCases( StringRef unmatchedSpec ) { + void MultiReporter::noMatchingTestCases( StringRef unmatchedSpec ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->noMatchingTestCases( unmatchedSpec ); } } - void ListeningReporter::fatalErrorEncountered( StringRef error ) { + void MultiReporter::fatalErrorEncountered( StringRef error ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->fatalErrorEncountered( error ); } } - void ListeningReporter::reportInvalidTestSpec( StringRef arg ) { + void MultiReporter::reportInvalidTestSpec( StringRef arg ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->reportInvalidTestSpec( arg ); } } - void ListeningReporter::benchmarkPreparing( StringRef name ) { + void MultiReporter::benchmarkPreparing( StringRef name ) { for (auto& reporterish : m_reporterLikes) { reporterish->benchmarkPreparing(name); } } - void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { + void MultiReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->benchmarkStarting( benchmarkInfo ); } } - void ListeningReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { + void MultiReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->benchmarkEnded( benchmarkStats ); } } - void ListeningReporter::benchmarkFailed( StringRef error ) { + void MultiReporter::benchmarkFailed( StringRef error ) { for (auto& reporterish : m_reporterLikes) { reporterish->benchmarkFailed(error); } } - void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { + void MultiReporter::testRunStarting( TestRunInfo const& testRunInfo ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->testRunStarting( testRunInfo ); } } - void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + void MultiReporter::testCaseStarting( TestCaseInfo const& testInfo ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->testCaseStarting( testInfo ); } } void - ListeningReporter::testCasePartialStarting( TestCaseInfo const& testInfo, + MultiReporter::testCasePartialStarting( TestCaseInfo const& testInfo, uint64_t partNumber ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->testCasePartialStarting( testInfo, partNumber ); } } - void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { + void MultiReporter::sectionStarting( SectionInfo const& sectionInfo ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->sectionStarting( sectionInfo ); } } - void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { + void MultiReporter::assertionStarting( AssertionInfo const& assertionInfo ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->assertionStarting( assertionInfo ); } } // The return value indicates if the messages buffer should be cleared: - void ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { + void MultiReporter::assertionEnded( AssertionStats const& assertionStats ) { const bool reportByDefault = assertionStats.assertionResult.getResultType() != ResultWas::Ok || m_config->includeSuccessfulResults(); @@ -128,13 +128,13 @@ namespace Catch { } } - void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { + void MultiReporter::sectionEnded( SectionStats const& sectionStats ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->sectionEnded( sectionStats ); } } - void ListeningReporter::testCasePartialEnded( TestCaseStats const& testStats, + void MultiReporter::testCasePartialEnded( TestCaseStats const& testStats, uint64_t partNumber ) { if ( m_preferences.shouldRedirectStdOut && m_haveNoncapturingReporters ) { @@ -151,38 +151,38 @@ namespace Catch { } } - void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + void MultiReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->testCaseEnded( testCaseStats ); } } - void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { + void MultiReporter::testRunEnded( TestRunStats const& testRunStats ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->testRunEnded( testRunStats ); } } - void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { + void MultiReporter::skipTest( TestCaseInfo const& testInfo ) { for ( auto& reporterish : m_reporterLikes ) { reporterish->skipTest( testInfo ); } } - void ListeningReporter::listReporters(std::vector const& descriptions) { + void MultiReporter::listReporters(std::vector const& descriptions) { for (auto& reporterish : m_reporterLikes) { reporterish->listReporters(descriptions); } } - void ListeningReporter::listTests(std::vector const& tests) { + void MultiReporter::listTests(std::vector const& tests) { for (auto& reporterish : m_reporterLikes) { reporterish->listTests(tests); } } - void ListeningReporter::listTags(std::vector const& tags) { + void MultiReporter::listTags(std::vector const& tags) { for (auto& reporterish : m_reporterLikes) { reporterish->listTags(tags); } diff --git a/src/catch2/reporters/catch_reporter_listening.hpp b/src/catch2/reporters/catch_reporter_multi.hpp similarity index 91% rename from src/catch2/reporters/catch_reporter_listening.hpp rename to src/catch2/reporters/catch_reporter_multi.hpp index 133ce8e1..b8599a9e 100644 --- a/src/catch2/reporters/catch_reporter_listening.hpp +++ b/src/catch2/reporters/catch_reporter_multi.hpp @@ -5,14 +5,14 @@ // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -#ifndef CATCH_REPORTER_LISTENING_HPP_INCLUDED -#define CATCH_REPORTER_LISTENING_HPP_INCLUDED +#ifndef CATCH_REPORTER_MULTI_HPP_INCLUDED +#define CATCH_REPORTER_MULTI_HPP_INCLUDED #include namespace Catch { - class ListeningReporter final : public IStreamingReporter { + class MultiReporter final : public IStreamingReporter { /* * Stores all added reporters and listeners * @@ -29,7 +29,7 @@ namespace Catch { void updatePreferences(IStreamingReporter const& reporterish); public: - ListeningReporter( IConfig const* config ): + MultiReporter( IConfig const* config ): IStreamingReporter( config ) {} @@ -70,4 +70,4 @@ namespace Catch { } // end namespace Catch -#endif // CATCH_REPORTER_LISTENING_HPP_INCLUDED +#endif // CATCH_REPORTER_MULTI_HPP_INCLUDED diff --git a/src/catch2/reporters/catch_reporters_all.hpp b/src/catch2/reporters/catch_reporters_all.hpp index ea6a2cb0..8c6208dc 100644 --- a/src/catch2/reporters/catch_reporters_all.hpp +++ b/src/catch2/reporters/catch_reporters_all.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp index 16fd17dd..8bb04352 100644 --- a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include @@ -165,7 +165,7 @@ TEST_CASE("Multireporter calls reporters and listeners in correct order", // We add reporters before listeners, to check that internally they // get sorted properly, and listeners are called first anyway. - Catch::ListeningReporter multiReporter( &config ); + Catch::MultiReporter multiReporter( &config ); std::vector records; multiReporter.addReporter( Catch::Detail::make_unique( "Goodbye", records, rep_config ) ); @@ -215,7 +215,7 @@ TEST_CASE("Multireporter updates ReporterPreferences properly", Catch::Config config( config_data ); std::stringstream sstream; Catch::ReporterConfig rep_config( &config, sstream ); - Catch::ListeningReporter multiReporter( &config ); + Catch::MultiReporter multiReporter( &config ); // Post init defaults REQUIRE( multiReporter.getPreferences().shouldRedirectStdOut == false );