mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-04 05:09:53 +01:00
Some listener and factory clean-ups
This commit is contained in:
parent
dd78824697
commit
a96f25c716
@ -42,7 +42,7 @@ namespace Catch {
|
|||||||
return reporter;
|
return reporter;
|
||||||
}
|
}
|
||||||
Ptr<IStreamingReporter> addListeners( IConfigPtr const& config, Ptr<IStreamingReporter> reporters ) {
|
Ptr<IStreamingReporter> addListeners( IConfigPtr const& config, Ptr<IStreamingReporter> reporters ) {
|
||||||
IReporterRegistry::Listeners listeners = getRegistryHub().getReporterRegistry().getListeners();
|
auto const& listeners = getRegistryHub().getReporterRegistry().getListeners();
|
||||||
for( auto const& listener : listeners )
|
for( auto const& listener : listeners )
|
||||||
reporters = addReporter(reporters, listener->create( ReporterConfig( config ) ) );
|
reporters = addReporter(reporters, listener->create( ReporterConfig( config ) ) );
|
||||||
return reporters;
|
return reporters;
|
||||||
|
@ -123,12 +123,11 @@ namespace Catch {
|
|||||||
inline std::size_t listReporters( Config const& /*config*/ ) {
|
inline std::size_t listReporters( Config const& /*config*/ ) {
|
||||||
Catch::cout() << "Available reporters:\n";
|
Catch::cout() << "Available reporters:\n";
|
||||||
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
|
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
|
||||||
IReporterRegistry::FactoryMap::const_iterator itBegin = factories.begin(), itEnd = factories.end(), it;
|
|
||||||
std::size_t maxNameLen = 0;
|
std::size_t maxNameLen = 0;
|
||||||
for( auto const factoryKvp : getRegistryHub().getReporterRegistry().getFactories() )
|
for( auto const& factoryKvp : getRegistryHub().getReporterRegistry().getFactories() )
|
||||||
maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
|
maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
|
||||||
|
|
||||||
for( auto const factoryKvp : getRegistryHub().getReporterRegistry().getFactories() ) {
|
for( auto const& factoryKvp : getRegistryHub().getReporterRegistry().getFactories() ) {
|
||||||
Text wrapper( factoryKvp.second->getDescription(), TextAttributes()
|
Text wrapper( factoryKvp.second->getDescription(), TextAttributes()
|
||||||
.setInitialIndent( 0 )
|
.setInitialIndent( 0 )
|
||||||
.setIndent( 7+maxNameLen )
|
.setIndent( 7+maxNameLen )
|
||||||
|
@ -28,7 +28,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
|
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
|
||||||
m_factories.insert( std::make_pair( name, factory ) );
|
m_factories.insert( { name, factory } );
|
||||||
}
|
}
|
||||||
void registerListener( IReporterFactoryPtr const& factory ) {
|
void registerListener( IReporterFactoryPtr const& factory ) {
|
||||||
m_listeners.push_back( factory );
|
m_listeners.push_back( factory );
|
||||||
|
Loading…
Reference in New Issue
Block a user