mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 19:33:29 +01:00
Rename listening reporter to multi reporter
This commit is contained in:
parent
244680d512
commit
103cb16696
@ -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
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <catch2/internal/catch_sharding.hpp>
|
||||
#include <catch2/internal/catch_textflow.hpp>
|
||||
#include <catch2/internal/catch_windows_h_proxy.hpp>
|
||||
#include <catch2/reporters/catch_reporter_listening.hpp>
|
||||
#include <catch2/reporters/catch_reporter_multi.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp>
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
@ -48,7 +48,7 @@ namespace Catch {
|
||||
return createReporter(config->getReportersAndOutputFiles()[0].reporterName, ReporterConfig(config, stream));
|
||||
}
|
||||
|
||||
auto multi = Detail::make_unique<ListeningReporter>(config);
|
||||
auto multi = Detail::make_unique<MultiReporter>(config);
|
||||
|
||||
auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
|
||||
for (auto const& listener : listeners) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
#include <catch2/reporters/catch_reporter_listening.hpp>
|
||||
#include <catch2/reporters/catch_reporter_multi.hpp>
|
||||
|
||||
#include <catch2/catch_config.hpp>
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
@ -14,20 +14,20 @@
|
||||
#include <cassert>
|
||||
|
||||
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<ReporterDescription> const& descriptions) {
|
||||
void MultiReporter::listReporters(std::vector<ReporterDescription> const& descriptions) {
|
||||
for (auto& reporterish : m_reporterLikes) {
|
||||
reporterish->listReporters(descriptions);
|
||||
}
|
||||
}
|
||||
|
||||
void ListeningReporter::listTests(std::vector<TestCaseHandle> const& tests) {
|
||||
void MultiReporter::listTests(std::vector<TestCaseHandle> const& tests) {
|
||||
for (auto& reporterish : m_reporterLikes) {
|
||||
reporterish->listTests(tests);
|
||||
}
|
||||
}
|
||||
|
||||
void ListeningReporter::listTags(std::vector<TagInfo> const& tags) {
|
||||
void MultiReporter::listTags(std::vector<TagInfo> const& tags) {
|
||||
for (auto& reporterish : m_reporterLikes) {
|
||||
reporterish->listTags(tags);
|
||||
}
|
@ -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 <catch2/interfaces/catch_interfaces_reporter.hpp>
|
||||
|
||||
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
|
@ -28,7 +28,7 @@
|
||||
#include <catch2/reporters/catch_reporter_event_listener.hpp>
|
||||
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
||||
#include <catch2/reporters/catch_reporter_junit.hpp>
|
||||
#include <catch2/reporters/catch_reporter_listening.hpp>
|
||||
#include <catch2/reporters/catch_reporter_multi.hpp>
|
||||
#include <catch2/reporters/catch_reporter_registrars.hpp>
|
||||
#include <catch2/reporters/catch_reporter_sonarqube.hpp>
|
||||
#include <catch2/reporters/catch_reporter_streaming_base.hpp>
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
||||
#include <catch2/reporters/catch_reporter_event_listener.hpp>
|
||||
#include <catch2/reporters/catch_reporter_streaming_base.hpp>
|
||||
#include <catch2/reporters/catch_reporter_listening.hpp>
|
||||
#include <catch2/reporters/catch_reporter_multi.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@ -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<std::string> records;
|
||||
multiReporter.addReporter( Catch::Detail::make_unique<MockReporter>(
|
||||
"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 );
|
||||
|
Loading…
Reference in New Issue
Block a user