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.
This commit is contained in:
Martin Hořeňovský
2024-03-26 23:48:35 +01:00
parent c0dfe13bb6
commit 7ce3579976
2 changed files with 21 additions and 10 deletions

View File

@@ -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() ) {