Push down handling of default reporter to Config's constructor

This simplifies the handling of default reporter in console
parsing, at the cost of making `Config`'s constructor responsible
for more things.
This commit is contained in:
Martin Hořeňovský 2022-02-17 20:44:27 +01:00
parent 7cf2f88e50
commit fc5552d27b
No known key found for this signature in database
GPG key ID: DE48307B8B0D381A
15 changed files with 132 additions and 54 deletions

View file

@ -139,15 +139,6 @@ namespace Catch {
return ParserResult::runtimeError( "Received empty reporter spec." );
}
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
// clear the default reporter
if (!config._nonDefaultReporterSpecifications) {
config.reporterSpecifications.clear();
config._nonDefaultReporterSpecifications = true;
}
// Exactly one of the reporters may be specified without an output
// file, in which case it defaults to the output specified by "-o"
// (or standard output).
@ -176,6 +167,8 @@ namespace Catch {
fileNameSeparatorPos + separatorSize, reporterSpec.size() );
}
IReporterRegistry::FactoryMap const& factories =
getRegistryHub().getReporterRegistry().getFactories();
auto result = factories.find( reporterName );
if( result == factories.end() )