Removed intermediate IConfig ptr

This commit is contained in:
Phil Nash 2017-07-18 18:03:57 +01:00
parent c7931f6f18
commit d43024ff6b
1 changed files with 12 additions and 13 deletions

View File

@ -50,12 +50,10 @@ namespace Catch {
Totals runTests( std::shared_ptr<Config> const& config ) { Totals runTests( std::shared_ptr<Config> const& config ) {
IConfigPtr iconfig = config;
IStreamingReporterPtr reporter = makeReporter( config ); IStreamingReporterPtr reporter = makeReporter( config );
addListeners( reporter, iconfig ); addListeners( reporter, config );
RunContext context( iconfig, std::move( reporter ) ); RunContext context( config, std::move( reporter ) );
Totals totals; Totals totals;
@ -65,15 +63,15 @@ namespace Catch {
if( !testSpec.hasFilters() ) if( !testSpec.hasFilters() )
testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "~[.]" ).testSpec(); // All not hidden tests testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "~[.]" ).testSpec(); // All not hidden tests
std::vector<TestCase> const& allTestCases = getAllTestCasesSorted( *iconfig ); std::vector<TestCase> const& allTestCases = getAllTestCasesSorted( *config );
for( auto const& testCase : allTestCases ) { for( auto const& testCase : allTestCases ) {
if( !context.aborting() && matchTest( testCase, testSpec, *iconfig ) ) if( !context.aborting() && matchTest( testCase, testSpec, *config ) )
totals += context.runTest( testCase ); totals += context.runTest( testCase );
else else
context.reporter().skipTest( testCase ); context.reporter().skipTest( testCase );
} }
context.testGroupEnded( iconfig->name(), totals, 1, 1 ); context.testGroupEnded( config->name(), totals, 1, 1 );
return totals; return totals;
} }
@ -96,6 +94,7 @@ namespace Catch {
} }
} }
class Session : NonCopyable { class Session : NonCopyable {
static const int MaxExitCode; static const int MaxExitCode;
public: public:
@ -112,10 +111,10 @@ namespace Catch {
} }
void showHelp() { void showHelp() {
Catch::cout() << "\nCatch v" << libraryVersion() << "\n"; Catch::cout()
<< "\nCatch v" << libraryVersion() << "\n"
Catch::cout() << m_cli << std::endl; << m_cli << std::endl
Catch::cout() << "For more detailed usage please see the project docs\n" << std::endl; << "For more detailed usage please see the project docs\n" << std::endl;
} }
int applyCommandLine( int argc, char* argv[] ) { int applyCommandLine( int argc, char* argv[] ) {
@ -138,8 +137,8 @@ namespace Catch {
return 0; return 0;
} }
void useConfigData( ConfigData const& _configData ) { void useConfigData( ConfigData const& configData ) {
m_configData = _configData; m_configData = configData;
m_config.reset(); m_config.reset();
} }