Refactoring towards interface based config

This commit is contained in:
Phil Nash 2013-05-28 18:39:32 +01:00
parent 10fa0593db
commit e1459955f1
17 changed files with 754 additions and 245 deletions

View File

@ -24,9 +24,8 @@ namespace Catch {
class Runner2 { // This will become Runner when Runner becomes Context class Runner2 { // This will become Runner when Runner becomes Context
public: public:
Runner2( Config& configWrapper ) Runner2( Ptr<Config> const& config )
: m_configWrapper( configWrapper ), : m_config( config )
m_config( configWrapper.data() )
{ {
openStream(); openStream();
makeReporter(); makeReporter();
@ -34,13 +33,13 @@ namespace Catch {
Totals runTests() { Totals runTests() {
std::vector<TestCaseFilters> filterGroups = m_config.filters; std::vector<TestCaseFilters> filterGroups = m_config->data().filters;
if( filterGroups.empty() ) { if( filterGroups.empty() ) {
TestCaseFilters filterGroup( "" ); TestCaseFilters filterGroup( "" );
filterGroups.push_back( filterGroup ); filterGroups.push_back( filterGroup );
} }
Runner context( m_configWrapper, m_reporter ); // This Runner will be renamed Context Runner context( m_config, m_reporter ); // This Runner will be renamed Context
Totals totals; Totals totals;
for( std::size_t i=0; i < filterGroups.size() && !context.aborting(); ++i ) { for( std::size_t i=0; i < filterGroups.size() && !context.aborting(); ++i ) {
@ -77,28 +76,26 @@ namespace Catch {
private: private:
void openStream() { void openStream() {
if( !m_config.stream.empty() ) if( !m_config->data().stream.empty() )
m_configWrapper.useStream( m_config.stream ); m_config->useStream( m_config->data().stream );
// Open output file, if specified // Open output file, if specified
if( !m_config.outputFilename.empty() ) { if( !m_config->getFilename().empty() ) {
m_ofs.open( m_config.outputFilename.c_str() ); m_ofs.open( m_config->getFilename().c_str() );
if( m_ofs.fail() ) { if( m_ofs.fail() ) {
std::ostringstream oss; std::ostringstream oss;
oss << "Unable to open file: '" << m_config.outputFilename << "'"; oss << "Unable to open file: '" << m_config->getFilename() << "'";
throw std::domain_error( oss.str() ); throw std::domain_error( oss.str() );
} }
m_configWrapper.setStreamBuf( m_ofs.rdbuf() ); m_config->setStreamBuf( m_ofs.rdbuf() );
} }
} }
void makeReporter() { void makeReporter() {
std::string reporterName = m_config.reporter.empty() std::string reporterName = m_config->data().reporter.empty()
? "console" ? "console"
: m_config.reporter; : m_config->data().reporter;
ReporterConfig reporterConfig( m_configWrapper.stream(), m_config ); m_reporter = getRegistryHub().getReporterRegistry().create( reporterName, m_config.get() );
m_reporter = getRegistryHub().getReporterRegistry().create( reporterName, reporterConfig );
if( !m_reporter ) { if( !m_reporter ) {
std::ostringstream oss; std::ostringstream oss;
oss << "No reporter registered with name: '" << reporterName << "'"; oss << "No reporter registered with name: '" << reporterName << "'";
@ -107,24 +104,23 @@ namespace Catch {
} }
private: private:
Config& m_configWrapper; Ptr<Config> m_config;
const ConfigData& m_config;
std::ofstream m_ofs; std::ofstream m_ofs;
Ptr<IStreamingReporter> m_reporter; Ptr<IStreamingReporter> m_reporter;
std::set<TestCase> m_testsAlreadyRun; std::set<TestCase> m_testsAlreadyRun;
}; };
inline int Main( Config& configWrapper ) { inline int Main( Ptr<Config> const& config ) {
int result = 0; int result = 0;
try try
{ {
Runner2 runner( configWrapper ); Runner2 runner( config );
const ConfigData& config = configWrapper.data(); const ConfigData& configData = config->data();
// Handle list request // Handle list request
if( config.listSpec != List::None ) { if( configData.listSpec != List::None ) {
list( config ); list( configData );
Catch::cleanUp(); Catch::cleanUp();
return 0; return 0;
} }
@ -177,7 +173,7 @@ namespace Catch {
} }
} }
inline int Main( int argc, char* const argv[], Config& config ) { inline int Main( int argc, char* const argv[], Ptr<Config> const& config ) {
try { try {
CommandParser parser( argc, argv ); CommandParser parser( argc, argv );
@ -193,7 +189,7 @@ namespace Catch {
AllOptions options; AllOptions options;
options.parseIntoConfig( parser, config.data() ); options.parseIntoConfig( parser, config->data() );
} }
catch( std::exception& ex ) { catch( std::exception& ex ) {
std::cerr << ex.what() << "\n\nUsage: ...\n\n"; std::cerr << ex.what() << "\n\nUsage: ...\n\n";
@ -206,7 +202,7 @@ namespace Catch {
} }
inline int Main( int argc, char* const argv[] ) { inline int Main( int argc, char* const argv[] ) {
Config config; Ptr<Config> config = new Config();
// !TBD: This doesn't always work, for some reason // !TBD: This doesn't always work, for some reason
// if( isDebuggerActive() ) // if( isDebuggerActive() )
// config.useStream( "debug" ); // config.useStream( "debug" );

View File

@ -75,7 +75,7 @@ namespace Catch {
}; };
class Config : public IConfig { class Config : public SharedImpl<IConfig> {
private: private:
Config( Config const& other ); Config( Config const& other );
Config& operator = ( Config const& other ); Config& operator = ( Config const& other );
@ -124,10 +124,6 @@ namespace Catch {
return m_data.shouldDebugBreak; return m_data.shouldDebugBreak;
} }
virtual std::ostream& stream() const {
return m_os;
}
void setStreamBuf( std::streambuf* buf ) { void setStreamBuf( std::streambuf* buf ) {
m_os.rdbuf( buf ? buf : std::cout.rdbuf() ); m_os.rdbuf( buf ? buf : std::cout.rdbuf() );
} }
@ -145,18 +141,10 @@ namespace Catch {
m_data.filters.push_back( filters ); m_data.filters.push_back( filters );
} }
virtual bool includeSuccessfulResults() const {
return m_data.includeWhichResults == Include::SuccessfulResults;
}
int getCutoff() const { int getCutoff() const {
return m_data.cutoff; return m_data.cutoff;
} }
virtual bool allowThrows() const {
return m_data.allowThrows;
}
ConfigData const& data() const { ConfigData const& data() const {
return m_data; return m_data;
} }
@ -164,6 +152,13 @@ namespace Catch {
return m_data; return m_data;
} }
// IConfig interface
virtual bool allowThrows() const { return m_data.allowThrows; }
virtual std::ostream& stream() const { return m_os; }
virtual std::string name() const { return m_data.name; }
virtual bool includeSuccessfulResults() const { return m_data.includeWhichResults == Include::SuccessfulResults; }
virtual bool warnAboutMissingAssertions() const { return m_data.warnings & ConfigData::WarnAbout::NoAssertions; }
private: private:
ConfigData m_data; ConfigData m_data;

View File

@ -9,6 +9,7 @@
#define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED #define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
#include "catch_interfaces_generators.h" #include "catch_interfaces_generators.h"
#include "catch_ptr.hpp"
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -31,7 +32,7 @@ namespace Catch {
virtual IRunner& getRunner() = 0; virtual IRunner& getRunner() = 0;
virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) = 0; virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) = 0;
virtual bool advanceGeneratorsForCurrentTest() = 0; virtual bool advanceGeneratorsForCurrentTest() = 0;
virtual const IConfig* getConfig() const = 0; virtual Ptr<IConfig> getConfig() const = 0;
}; };
struct IMutableContext : IContext struct IMutableContext : IContext
@ -39,7 +40,7 @@ namespace Catch {
virtual ~IMutableContext(); virtual ~IMutableContext();
virtual void setResultCapture( IResultCapture* resultCapture ) = 0; virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
virtual void setRunner( IRunner* runner ) = 0; virtual void setRunner( IRunner* runner ) = 0;
virtual void setConfig( const IConfig* config ) = 0; virtual void setConfig( Ptr<IConfig> const& config ) = 0;
}; };
IContext& getCurrentContext(); IContext& getCurrentContext();

View File

@ -38,7 +38,7 @@ namespace Catch {
return generators && generators->moveNext(); return generators && generators->moveNext();
} }
virtual const IConfig* getConfig() const { virtual Ptr<IConfig> getConfig() const {
return m_config; return m_config;
} }
@ -49,7 +49,7 @@ namespace Catch {
virtual void setRunner( IRunner* runner ) { virtual void setRunner( IRunner* runner ) {
m_runner = runner; m_runner = runner;
} }
virtual void setConfig( const IConfig* config ) { virtual void setConfig( Ptr<IConfig> const& config ) {
m_config = config; m_config = config;
} }
@ -79,7 +79,7 @@ namespace Catch {
private: private:
IRunner* m_runner; IRunner* m_runner;
IResultCapture* m_resultCapture; IResultCapture* m_resultCapture;
const IConfig* m_config; Ptr<IConfig> m_config;
std::map<std::string, IGeneratorsForTest*> m_generatorsByTestName; std::map<std::string, IGeneratorsForTest*> m_generatorsByTestName;
}; };

View File

@ -8,13 +8,22 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED #ifndef TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED #define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
#include <iostream>
#include <string>
#include "catch_ptr.hpp"
namespace Catch { namespace Catch {
struct IConfig { struct IConfig : IShared {
virtual ~IConfig(); virtual ~IConfig();
virtual bool allowThrows() const = 0; virtual bool allowThrows() const = 0;
virtual std::ostream& stream() const = 0;
virtual std::string name() const = 0;
virtual bool includeSuccessfulResults() const = 0;
virtual bool warnAboutMissingAssertions() const = 0;
}; };
} }

View File

@ -24,17 +24,18 @@
namespace Catch namespace Catch
{ {
struct ReporterConfig { struct ReporterConfig {
ReporterConfig( std::ostream& _stream, ConfigData const& _fullConfig ) explicit ReporterConfig( Ptr<IConfig> const& _fullConfig )
: m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}
ReporterConfig( Ptr<IConfig> const& _fullConfig, std::ostream& _stream )
: m_stream( &_stream ), m_fullConfig( _fullConfig ) {} : m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
std::ostream& stream() const { return *m_stream; } std::ostream& stream() const { return *m_stream; }
std::string name() const { return m_fullConfig.name; } Ptr<IConfig> fullConfig() const { return m_fullConfig; }
bool includeSuccessfulResults() const { return m_fullConfig.includeWhichResults == Include::SuccessfulResults; }
bool warnAboutMissingAssertions() const { return m_fullConfig.warnings & ConfigData::WarnAbout::NoAssertions; }
private: private:
std::ostream* m_stream; std::ostream* m_stream;
ConfigData m_fullConfig; Ptr<IConfig> m_fullConfig;
}; };
struct ReporterPreferences { struct ReporterPreferences {
@ -217,7 +218,7 @@ namespace Catch
struct StreamingReporterBase : SharedImpl<IStreamingReporter> { struct StreamingReporterBase : SharedImpl<IStreamingReporter> {
StreamingReporterBase( ReporterConfig const& _config ) StreamingReporterBase( ReporterConfig const& _config )
: m_config( _config ), : m_config( _config.fullConfig() ),
stream( _config.stream() ) stream( _config.stream() )
{} {}
@ -264,7 +265,7 @@ namespace Catch
testRunInfo.reset(); testRunInfo.reset();
} }
ReporterConfig m_config; Ptr<IConfig> m_config;
Option<TestRunInfo> testRunInfo; Option<TestRunInfo> testRunInfo;
Option<GroupInfo> unusedGroupInfo; Option<GroupInfo> unusedGroupInfo;
Option<TestCaseInfo> unusedTestCaseInfo; Option<TestCaseInfo> unusedTestCaseInfo;
@ -321,7 +322,7 @@ namespace Catch
typedef std::map<std::string, IReporterFactory*> FactoryMap; typedef std::map<std::string, IReporterFactory*> FactoryMap;
virtual ~IReporterRegistry(); virtual ~IReporterRegistry();
virtual IStreamingReporter* create( std::string const& name, ReporterConfig const& config ) const = 0; virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig> const& config ) const = 0;
virtual FactoryMap const& getFactories() const = 0; virtual FactoryMap const& getFactories() const = 0;
}; };

View File

@ -15,7 +15,7 @@ namespace Catch
class LegacyReporterAdapter : public SharedImpl<IStreamingReporter> class LegacyReporterAdapter : public SharedImpl<IStreamingReporter>
{ {
public: public:
LegacyReporterAdapter( Ptr<IReporter> const& legacyReporter, ReporterConfig const& config ); LegacyReporterAdapter( Ptr<IReporter> const& legacyReporter );
virtual ~LegacyReporterAdapter(); virtual ~LegacyReporterAdapter();
virtual ReporterPreferences getPreferences() const; virtual ReporterPreferences getPreferences() const;
@ -33,7 +33,6 @@ namespace Catch
private: private:
Ptr<IReporter> m_legacyReporter; Ptr<IReporter> m_legacyReporter;
ReporterConfig m_config;
}; };
} }

View File

@ -12,9 +12,8 @@
namespace Catch namespace Catch
{ {
LegacyReporterAdapter::LegacyReporterAdapter( Ptr<IReporter> const& legacyReporter, ReporterConfig const& config ) LegacyReporterAdapter::LegacyReporterAdapter( Ptr<IReporter> const& legacyReporter )
: m_legacyReporter( legacyReporter ), : m_legacyReporter( legacyReporter )
m_config( config )
{} {}
LegacyReporterAdapter::~LegacyReporterAdapter() {} LegacyReporterAdapter::~LegacyReporterAdapter() {}

View File

@ -19,7 +19,7 @@ namespace Catch {
class ReporterFactory : public IReporterFactory { class ReporterFactory : public IReporterFactory {
virtual IStreamingReporter* create( ReporterConfig const& config ) const { virtual IStreamingReporter* create( ReporterConfig const& config ) const {
return new LegacyReporterAdapter( new T( config ), config ); return new LegacyReporterAdapter( new T( config ) );
} }
virtual std::string getDescription() const { virtual std::string getDescription() const {

View File

@ -22,11 +22,11 @@ namespace Catch {
deleteAllValues( m_factories ); deleteAllValues( m_factories );
} }
virtual IStreamingReporter* create( std::string const& name, ReporterConfig const& config ) const { virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig> const& config ) const {
FactoryMap::const_iterator it = m_factories.find( name ); FactoryMap::const_iterator it = m_factories.find( name );
if( it == m_factories.end() ) if( it == m_factories.end() )
return NULL; return NULL;
return it->second->create( config ); return it->second->create( ReporterConfig( config ) );
} }
void registerReporter( std::string const& name, IReporterFactory* factory ) { void registerReporter( std::string const& name, IReporterFactory* factory ) {

View File

@ -56,8 +56,8 @@ namespace Catch {
public: public:
explicit Runner( Config const& config, Ptr<IStreamingReporter> const& reporter ) explicit Runner( Ptr<Config> const& config, Ptr<IStreamingReporter> const& reporter )
: m_runInfo( config.data().name ), : m_runInfo( config->name() ),
m_context( getCurrentMutableContext() ), m_context( getCurrentMutableContext() ),
m_runningTest( NULL ), m_runningTest( NULL ),
m_config( config ), m_config( config ),
@ -67,7 +67,7 @@ namespace Catch {
m_prevConfig( m_context.getConfig() ) m_prevConfig( m_context.getConfig() )
{ {
m_context.setRunner( this ); m_context.setRunner( this );
m_context.setConfig( &m_config ); m_context.setConfig( m_config.get() );
m_context.setResultCapture( this ); m_context.setResultCapture( this );
m_reporter->testRunStarting( m_runInfo ); m_reporter->testRunStarting( m_runInfo );
} }
@ -127,7 +127,7 @@ namespace Catch {
Totals deltaTotals = m_totals.delta( prevTotals ); Totals deltaTotals = m_totals.delta( prevTotals );
bool missingAssertions = false; bool missingAssertions = false;
if( deltaTotals.assertions.total() == 0 && if( deltaTotals.assertions.total() == 0 &&
( m_config.data().warnings & ConfigData::WarnAbout::NoAssertions ) ) { ( m_config->data().warnings & ConfigData::WarnAbout::NoAssertions ) ) {
m_totals.assertions.failed++; m_totals.assertions.failed++;
deltaTotals = m_totals.delta( prevTotals ); deltaTotals = m_totals.delta( prevTotals );
missingAssertions = true; missingAssertions = true;
@ -149,7 +149,7 @@ namespace Catch {
return deltaTotals; return deltaTotals;
} }
Config const& config() const { Ptr<Config> config() const {
return m_config; return m_config;
} }
@ -209,7 +209,7 @@ namespace Catch {
Counts assertions = m_totals.assertions - prevAssertions; Counts assertions = m_totals.assertions - prevAssertions;
bool missingAssertions = false; bool missingAssertions = false;
if( assertions.total() == 0 && if( assertions.total() == 0 &&
( m_config.data().warnings & ConfigData::WarnAbout::NoAssertions ) && ( m_config->data().warnings & ConfigData::WarnAbout::NoAssertions ) &&
!m_runningTest->isBranchSection() ) { !m_runningTest->isBranchSection() ) {
m_totals.assertions.failed++; m_totals.assertions.failed++;
assertions.failed++; assertions.failed++;
@ -231,7 +231,7 @@ namespace Catch {
} }
virtual bool shouldDebugBreak() const { virtual bool shouldDebugBreak() const {
return m_config.shouldDebugBreak(); return m_config->shouldDebugBreak();
} }
virtual std::string getCurrentTestName() const { virtual std::string getCurrentTestName() const {
@ -247,7 +247,7 @@ namespace Catch {
public: public:
// !TBD We need to do this another way! // !TBD We need to do this another way!
bool aborting() const { bool aborting() const {
return m_totals.assertions.failed == static_cast<std::size_t>( m_config.getCutoff() ); return m_totals.assertions.failed == static_cast<std::size_t>( m_config->getCutoff() );
} }
private: private:
@ -315,13 +315,13 @@ namespace Catch {
RunningTest* m_runningTest; RunningTest* m_runningTest;
AssertionResult m_lastResult; AssertionResult m_lastResult;
Config const& m_config; Ptr<Config> m_config;
Totals m_totals; Totals m_totals;
Ptr<IStreamingReporter> m_reporter; Ptr<IStreamingReporter> m_reporter;
std::vector<MessageInfo> m_messages; std::vector<MessageInfo> m_messages;
IRunner* m_prevRunner; IRunner* m_prevRunner;
IResultCapture* m_prevResultCapture; IResultCapture* m_prevResultCapture;
const IConfig* m_prevConfig; Ptr<IConfig> m_prevConfig;
AssertionInfo m_lastAssertionInfo; AssertionInfo m_lastAssertionInfo;
std::vector<UnfinishedSections> m_unfinishedSections; std::vector<UnfinishedSections> m_unfinishedSections;
}; };

View File

@ -160,7 +160,7 @@ namespace Catch {
} }
virtual void Result( const AssertionResult& assertionResult ) { virtual void Result( const AssertionResult& assertionResult ) {
if( !m_config.includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok ) if( !m_config.fullConfig()->includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok )
return; return;
startSpansLazily(); startSpansLazily();
@ -289,10 +289,10 @@ namespace Catch {
void startSpansLazily() { void startSpansLazily() {
if( !m_testingSpan.emitted ) { if( !m_testingSpan.emitted ) {
if( m_config.name().empty() ) if( m_config.fullConfig()->name().empty() )
m_config.stream() << "[Started testing]" << std::endl; m_config.stream() << "[Started testing]" << std::endl;
else else
m_config.stream() << "[Started testing: " << m_config.name() << "]" << std::endl; m_config.stream() << "[Started testing: " << m_config.fullConfig()->name() << "]" << std::endl;
m_testingSpan.emitted = true; m_testingSpan.emitted = true;
} }

View File

@ -43,7 +43,7 @@ namespace Catch {
AssertionResult const& result = _assertionStats.assertionResult; AssertionResult const& result = _assertionStats.assertionResult;
// Drop out if result was successful and we're not printing those // Drop out if result was successful and we're not printing those
if( !m_config.includeSuccessfulResults() && result.isOk() ) if( !m_config->includeSuccessfulResults() && result.isOk() )
return; return;
lazyPrint(); lazyPrint();

View File

@ -65,7 +65,7 @@ namespace Catch {
}; };
public: public:
JunitReporter( const ReporterConfig& config ) JunitReporter( ReporterConfig const& config )
: m_config( config ), : m_config( config ),
m_testSuiteStats( "AllTests" ), m_testSuiteStats( "AllTests" ),
m_currentStats( &m_testSuiteStats ) m_currentStats( &m_testSuiteStats )
@ -86,7 +86,7 @@ namespace Catch {
virtual void StartGroup( const std::string& groupName ) { virtual void StartGroup( const std::string& groupName ) {
if( groupName.empty() ) if( groupName.empty() )
m_statsForSuites.push_back( Stats( m_config.name() ) ); m_statsForSuites.push_back( Stats( m_config.fullConfig()->name() ) );
else else
m_statsForSuites.push_back( Stats( groupName ) ); m_statsForSuites.push_back( Stats( groupName ) );
m_currentStats = &m_statsForSuites.back(); m_currentStats = &m_statsForSuites.back();
@ -110,7 +110,7 @@ namespace Catch {
} }
virtual void Result( const Catch::AssertionResult& assertionResult ) { virtual void Result( const Catch::AssertionResult& assertionResult ) {
if( assertionResult.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults() ) { if( assertionResult.getResultType() != ResultWas::Ok || m_config.fullConfig()->includeSuccessfulResults() ) {
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back(); TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
TestStats stats; TestStats stats;
std::ostringstream oss; std::ostringstream oss;
@ -238,7 +238,6 @@ namespace Catch {
private: private:
ReporterConfig m_config; ReporterConfig m_config;
// bool m_currentTestSuccess;
Stats m_testSuiteStats; Stats m_testSuiteStats;
Stats* m_currentStats; Stats* m_currentStats;

View File

@ -16,7 +16,7 @@
namespace Catch { namespace Catch {
class XmlReporter : public SharedImpl<IReporter> { class XmlReporter : public SharedImpl<IReporter> {
public: public:
XmlReporter( const ReporterConfig& config ) : m_config( config ) {} XmlReporter( ReporterConfig const& config ) : m_config( config ) {}
static std::string getDescription() { static std::string getDescription() {
return "Reports test results as an XML document"; return "Reports test results as an XML document";
@ -32,8 +32,8 @@ namespace Catch {
virtual void StartTesting() { virtual void StartTesting() {
m_xml = XmlWriter( m_config.stream() ); m_xml = XmlWriter( m_config.stream() );
m_xml.startElement( "Catch" ); m_xml.startElement( "Catch" );
if( !m_config.name().empty() ) if( !m_config.fullConfig()->name().empty() )
m_xml.writeAttribute( "name", m_config.name() ); m_xml.writeAttribute( "name", m_config.fullConfig()->name() );
} }
virtual void EndTesting( const Totals& totals ) { virtual void EndTesting( const Totals& totals ) {
@ -76,7 +76,7 @@ namespace Catch {
} }
virtual void Result( const Catch::AssertionResult& assertionResult ) { virtual void Result( const Catch::AssertionResult& assertionResult ) {
if( !m_config.includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok ) if( !m_config.fullConfig()->includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok )
return; return;
if( assertionResult.hasExpression() ) { if( assertionResult.hasExpression() ) {

File diff suppressed because it is too large Load Diff

View File

@ -15,8 +15,8 @@ namespace Catch{
Totals EmbeddedRunner::runMatching( const std::string& rawTestSpec, std::size_t groupIndex, std::size_t groupsCount, const std::string& ) { Totals EmbeddedRunner::runMatching( const std::string& rawTestSpec, std::size_t groupIndex, std::size_t groupsCount, const std::string& ) {
std::ostringstream oss; std::ostringstream oss;
Config config; Ptr<Config> config = new Config();
config.setStreamBuf( oss.rdbuf() ); config->setStreamBuf( oss.rdbuf() );
Totals totals; Totals totals;