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

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2024-03-26 23:48:35 +0100
committerMartin Hořeňovský2024-03-27 10:03:51 +0100
commit7ce35799767de7b9c6ba836c72e479c5f70219a3 (patch)
tree57df1938c2e116e8fd00578250cfb496fdf5d673 /src
parentc0dfe13bb6cb23b8127035ea8b5d1ca50fcf3693 (diff)
downloadcatch3-7ce35799767de7b9c6ba836c72e479c5f70219a3.tar.gz
Allow CATCH_CONFIG_DEFAULT_REPORTER to be arbitrary reporter spec
Previously it could be just plain reporter name, e.g. `xml`, but it could not specify other reporter options. This change is not particularly useful for the built-in reporters, as it mostly comes in handy for combining specific custom reporter with custom arguments, and the built-in reporters do not have those.
Diffstat (limited to 'src')
-rw-r--r--src/catch2/catch_config.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp
index 34f50f17..352c1f42 100644
--- a/src/catch2/catch_config.cpp
+++ b/src/catch2/catch_config.cpp
@@ -107,14 +107,16 @@ namespace Catch {
// Insert the default reporter if user hasn't asked for a specific one
if ( m_data.reporterSpecifications.empty() ) {
- m_data.reporterSpecifications.push_back( {
#if defined( CATCH_CONFIG_DEFAULT_REPORTER )
- CATCH_CONFIG_DEFAULT_REPORTER,
+ const auto default_spec = CATCH_CONFIG_DEFAULT_REPORTER;
#else
- "console",
+ const auto default_spec = "console";
#endif
- {}, {}, {}
- } );
+ auto parsed = parseReporterSpec(default_spec);
+ CATCH_ENFORCE( parsed,
+ "Cannot parse the provided default reporter spec: '"
+ << default_spec << '\'' );
+ m_data.reporterSpecifications.push_back( std::move( *parsed ) );
}
if ( enableBazelEnvSupport() ) {