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

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/catch_config.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-04-04 21:07:04 +0200
committerMartin Hořeňovský2022-04-07 12:50:08 +0200
commit423e1d2ebbd75bb92cb486f83f2c5800b4b9689e (patch)
tree3cfff7f75517b1771ab43c7439ba195a77dcec31 /src/catch2/catch_config.cpp
parent3c06bcb374aaebf91ad1d63aba655dee66cf7b91 (diff)
downloadcatch3-423e1d2ebbd75bb92cb486f83f2c5800b4b9689e.tar.gz
Integrate the new reporter specs into Catch2
This means that the CLI interface now uses the new key-value oriented reporter spec, the common reporter base creates the colour implementation based on the reporter-specific configuration, and it also stores the custom configuration options for each reporter instance. Closes #339 as it allows per-reporter forcing of ansi colour codes.
Diffstat (limited to 'src/catch2/catch_config.cpp')
-rw-r--r--src/catch2/catch_config.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp
index 4c8b3319..75a92883 100644
--- a/src/catch2/catch_config.cpp
+++ b/src/catch2/catch_config.cpp
@@ -33,17 +33,6 @@ namespace Catch {
} // unnamed namespace
} // namespace Detail
- std::ostream& operator<<( std::ostream& os,
- ConfigData::ReporterAndFile const& reporter ) {
- os << "{ " << reporter.reporterName << ", ";
- if ( reporter.outputFileName ) {
- os << *reporter.outputFileName;
- } else {
- os << "<default-output>";
- }
- return os << " }";
- }
-
Config::Config( ConfigData const& data ):
m_data( data ) {
// We need to trim filter specs to avoid trouble with superfluous
@@ -76,14 +65,14 @@ namespace Catch {
#else
"console",
#endif
- {}
+ {}, {}, {}
} );
}
bool defaultOutputUsed = false;
m_reporterStreams.reserve( m_data.reporterSpecifications.size() );
- for ( auto const& reporterAndFile : m_data.reporterSpecifications ) {
- if ( reporterAndFile.outputFileName.none() ) {
+ for ( auto const& reporterSpec : m_data.reporterSpecifications ) {
+ if ( reporterSpec.outputFile().none() ) {
CATCH_ENFORCE( !defaultOutputUsed,
"Internal error: cannot use default output for "
"multiple reporters" );
@@ -93,7 +82,7 @@ namespace Catch {
openStream( data.defaultOutputFilename ) );
} else {
m_reporterStreams.push_back(
- openStream( *reporterAndFile.outputFileName ) );
+ openStream( *reporterSpec.outputFile() ) );
}
}
}
@@ -108,7 +97,7 @@ namespace Catch {
std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }
std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }
- std::vector<ConfigData::ReporterAndFile> const& Config::getReportersAndOutputFiles() const {
+ std::vector<ReporterSpec> const& Config::getReporterSpecs() const {
return m_data.reporterSpecifications;
}