diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp index 7f24d5b5..2998c866 100644 --- a/include/catch_runner.hpp +++ b/include/catch_runner.hpp @@ -24,9 +24,8 @@ namespace Catch { class Runner2 { // This will become Runner when Runner becomes Context public: - Runner2( Config& configWrapper ) - : m_configWrapper( configWrapper ), - m_config( configWrapper.data() ) + Runner2( Ptr const& config ) + : m_config( config ) { openStream(); makeReporter(); @@ -34,13 +33,13 @@ namespace Catch { Totals runTests() { - std::vector filterGroups = m_config.filters; + std::vector filterGroups = m_config->data().filters; if( filterGroups.empty() ) { TestCaseFilters 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; for( std::size_t i=0; i < filterGroups.size() && !context.aborting(); ++i ) { @@ -77,28 +76,26 @@ namespace Catch { private: void openStream() { - if( !m_config.stream.empty() ) - m_configWrapper.useStream( m_config.stream ); + if( !m_config->data().stream.empty() ) + m_config->useStream( m_config->data().stream ); // Open output file, if specified - if( !m_config.outputFilename.empty() ) { - m_ofs.open( m_config.outputFilename.c_str() ); + if( !m_config->getFilename().empty() ) { + m_ofs.open( m_config->getFilename().c_str() ); if( m_ofs.fail() ) { 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() ); } - m_configWrapper.setStreamBuf( m_ofs.rdbuf() ); + m_config->setStreamBuf( m_ofs.rdbuf() ); } } void makeReporter() { - std::string reporterName = m_config.reporter.empty() - ? "console" - : m_config.reporter; + std::string reporterName = m_config->data().reporter.empty() + ? "console" + : m_config->data().reporter; - ReporterConfig reporterConfig( m_configWrapper.stream(), m_config ); - - m_reporter = getRegistryHub().getReporterRegistry().create( reporterName, reporterConfig ); + m_reporter = getRegistryHub().getReporterRegistry().create( reporterName, m_config.get() ); if( !m_reporter ) { std::ostringstream oss; oss << "No reporter registered with name: '" << reporterName << "'"; @@ -107,24 +104,23 @@ namespace Catch { } private: - Config& m_configWrapper; - const ConfigData& m_config; + Ptr m_config; std::ofstream m_ofs; Ptr m_reporter; std::set m_testsAlreadyRun; }; - inline int Main( Config& configWrapper ) { + inline int Main( Ptr const& config ) { int result = 0; try { - Runner2 runner( configWrapper ); + Runner2 runner( config ); - const ConfigData& config = configWrapper.data(); + const ConfigData& configData = config->data(); // Handle list request - if( config.listSpec != List::None ) { - list( config ); + if( configData.listSpec != List::None ) { + list( configData ); Catch::cleanUp(); 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 const& config ) { try { CommandParser parser( argc, argv ); @@ -193,7 +189,7 @@ namespace Catch { AllOptions options; - options.parseIntoConfig( parser, config.data() ); + options.parseIntoConfig( parser, config->data() ); } catch( std::exception& ex ) { std::cerr << ex.what() << "\n\nUsage: ...\n\n"; @@ -206,7 +202,7 @@ namespace Catch { } inline int Main( int argc, char* const argv[] ) { - Config config; + Ptr config = new Config(); // !TBD: This doesn't always work, for some reason // if( isDebuggerActive() ) // config.useStream( "debug" ); diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 87c7d734..41415e4e 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -75,7 +75,7 @@ namespace Catch { }; - class Config : public IConfig { + class Config : public SharedImpl { private: Config( Config const& other ); Config& operator = ( Config const& other ); @@ -123,10 +123,6 @@ namespace Catch { bool shouldDebugBreak() const { return m_data.shouldDebugBreak; } - - virtual std::ostream& stream() const { - return m_os; - } void setStreamBuf( std::streambuf* buf ) { m_os.rdbuf( buf ? buf : std::cout.rdbuf() ); @@ -144,19 +140,11 @@ namespace Catch { filters.addFilter( TestCaseFilter( testSpec ) ); m_data.filters.push_back( filters ); } - - virtual bool includeSuccessfulResults() const { - return m_data.includeWhichResults == Include::SuccessfulResults; - } - + int getCutoff() const { return m_data.cutoff; } - virtual bool allowThrows() const { - return m_data.allowThrows; - } - ConfigData const& data() const { return m_data; } @@ -164,6 +152,13 @@ namespace Catch { 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: ConfigData m_data; diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h index 5b4976c6..c419544b 100644 --- a/include/internal/catch_context.h +++ b/include/internal/catch_context.h @@ -9,6 +9,7 @@ #define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED #include "catch_interfaces_generators.h" +#include "catch_ptr.hpp" #include #include @@ -31,15 +32,15 @@ namespace Catch { virtual IRunner& getRunner() = 0; virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) = 0; virtual bool advanceGeneratorsForCurrentTest() = 0; - virtual const IConfig* getConfig() const = 0; + virtual Ptr getConfig() const = 0; }; - + struct IMutableContext : IContext { virtual ~IMutableContext(); virtual void setResultCapture( IResultCapture* resultCapture ) = 0; virtual void setRunner( IRunner* runner ) = 0; - virtual void setConfig( const IConfig* config ) = 0; + virtual void setConfig( Ptr const& config ) = 0; }; IContext& getCurrentContext(); diff --git a/include/internal/catch_context_impl.hpp b/include/internal/catch_context_impl.hpp index d14aed40..3adcb9ce 100644 --- a/include/internal/catch_context_impl.hpp +++ b/include/internal/catch_context_impl.hpp @@ -38,7 +38,7 @@ namespace Catch { return generators && generators->moveNext(); } - virtual const IConfig* getConfig() const { + virtual Ptr getConfig() const { return m_config; } @@ -49,7 +49,7 @@ namespace Catch { virtual void setRunner( IRunner* runner ) { m_runner = runner; } - virtual void setConfig( const IConfig* config ) { + virtual void setConfig( Ptr const& config ) { m_config = config; } @@ -79,7 +79,7 @@ namespace Catch { private: IRunner* m_runner; IResultCapture* m_resultCapture; - const IConfig* m_config; + Ptr m_config; std::map m_generatorsByTestName; }; diff --git a/include/internal/catch_interfaces_config.h b/include/internal/catch_interfaces_config.h index 01abe56e..3db8bf2d 100644 --- a/include/internal/catch_interfaces_config.h +++ b/include/internal/catch_interfaces_config.h @@ -8,13 +8,22 @@ #ifndef TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED #define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED +#include +#include + +#include "catch_ptr.hpp" + namespace Catch { - struct IConfig { + struct IConfig : IShared { virtual ~IConfig(); 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; }; } diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 751135b8..6419afc0 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -24,17 +24,18 @@ namespace Catch { struct ReporterConfig { - ReporterConfig( std::ostream& _stream, ConfigData const& _fullConfig ) + explicit ReporterConfig( Ptr const& _fullConfig ) + : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + + ReporterConfig( Ptr const& _fullConfig, std::ostream& _stream ) : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} - std::ostream& stream() const { return *m_stream; } - std::string name() const { return m_fullConfig.name; } - bool includeSuccessfulResults() const { return m_fullConfig.includeWhichResults == Include::SuccessfulResults; } - bool warnAboutMissingAssertions() const { return m_fullConfig.warnings & ConfigData::WarnAbout::NoAssertions; } + std::ostream& stream() const { return *m_stream; } + Ptr fullConfig() const { return m_fullConfig; } private: std::ostream* m_stream; - ConfigData m_fullConfig; + Ptr m_fullConfig; }; struct ReporterPreferences { @@ -217,7 +218,7 @@ namespace Catch struct StreamingReporterBase : SharedImpl { StreamingReporterBase( ReporterConfig const& _config ) - : m_config( _config ), + : m_config( _config.fullConfig() ), stream( _config.stream() ) {} @@ -264,7 +265,7 @@ namespace Catch testRunInfo.reset(); } - ReporterConfig m_config; + Ptr m_config; Option testRunInfo; Option unusedGroupInfo; Option unusedTestCaseInfo; @@ -321,7 +322,7 @@ namespace Catch typedef std::map FactoryMap; virtual ~IReporterRegistry(); - virtual IStreamingReporter* create( std::string const& name, ReporterConfig const& config ) const = 0; + virtual IStreamingReporter* create( std::string const& name, Ptr const& config ) const = 0; virtual FactoryMap const& getFactories() const = 0; }; diff --git a/include/internal/catch_legacy_reporter_adapter.h b/include/internal/catch_legacy_reporter_adapter.h index 4d5457e6..08bf6854 100644 --- a/include/internal/catch_legacy_reporter_adapter.h +++ b/include/internal/catch_legacy_reporter_adapter.h @@ -15,7 +15,7 @@ namespace Catch class LegacyReporterAdapter : public SharedImpl { public: - LegacyReporterAdapter( Ptr const& legacyReporter, ReporterConfig const& config ); + LegacyReporterAdapter( Ptr const& legacyReporter ); virtual ~LegacyReporterAdapter(); virtual ReporterPreferences getPreferences() const; @@ -33,7 +33,6 @@ namespace Catch private: Ptr m_legacyReporter; - ReporterConfig m_config; }; } diff --git a/include/internal/catch_legacy_reporter_adapter.hpp b/include/internal/catch_legacy_reporter_adapter.hpp index 44d90af8..27ffc1e1 100644 --- a/include/internal/catch_legacy_reporter_adapter.hpp +++ b/include/internal/catch_legacy_reporter_adapter.hpp @@ -12,9 +12,8 @@ namespace Catch { - LegacyReporterAdapter::LegacyReporterAdapter( Ptr const& legacyReporter, ReporterConfig const& config ) - : m_legacyReporter( legacyReporter ), - m_config( config ) + LegacyReporterAdapter::LegacyReporterAdapter( Ptr const& legacyReporter ) + : m_legacyReporter( legacyReporter ) {} LegacyReporterAdapter::~LegacyReporterAdapter() {} diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp index f2c482b2..9e765c21 100644 --- a/include/internal/catch_reporter_registrars.hpp +++ b/include/internal/catch_reporter_registrars.hpp @@ -19,7 +19,7 @@ namespace Catch { class ReporterFactory : public IReporterFactory { 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 { diff --git a/include/internal/catch_reporter_registry.hpp b/include/internal/catch_reporter_registry.hpp index 8298758c..ac3ed683 100644 --- a/include/internal/catch_reporter_registry.hpp +++ b/include/internal/catch_reporter_registry.hpp @@ -22,11 +22,11 @@ namespace Catch { deleteAllValues( m_factories ); } - virtual IStreamingReporter* create( std::string const& name, ReporterConfig const& config ) const { + virtual IStreamingReporter* create( std::string const& name, Ptr const& config ) const { FactoryMap::const_iterator it = m_factories.find( name ); if( it == m_factories.end() ) return NULL; - return it->second->create( config ); + return it->second->create( ReporterConfig( config ) ); } void registerReporter( std::string const& name, IReporterFactory* factory ) { diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 18a3e03b..0451072e 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -56,8 +56,8 @@ namespace Catch { public: - explicit Runner( Config const& config, Ptr const& reporter ) - : m_runInfo( config.data().name ), + explicit Runner( Ptr const& config, Ptr const& reporter ) + : m_runInfo( config->name() ), m_context( getCurrentMutableContext() ), m_runningTest( NULL ), m_config( config ), @@ -67,7 +67,7 @@ namespace Catch { m_prevConfig( m_context.getConfig() ) { m_context.setRunner( this ); - m_context.setConfig( &m_config ); + m_context.setConfig( m_config.get() ); m_context.setResultCapture( this ); m_reporter->testRunStarting( m_runInfo ); } @@ -127,7 +127,7 @@ namespace Catch { Totals deltaTotals = m_totals.delta( prevTotals ); bool missingAssertions = false; if( deltaTotals.assertions.total() == 0 && - ( m_config.data().warnings & ConfigData::WarnAbout::NoAssertions ) ) { + ( m_config->data().warnings & ConfigData::WarnAbout::NoAssertions ) ) { m_totals.assertions.failed++; deltaTotals = m_totals.delta( prevTotals ); missingAssertions = true; @@ -149,7 +149,7 @@ namespace Catch { return deltaTotals; } - Config const& config() const { + Ptr config() const { return m_config; } @@ -209,7 +209,7 @@ namespace Catch { Counts assertions = m_totals.assertions - prevAssertions; bool missingAssertions = false; if( assertions.total() == 0 && - ( m_config.data().warnings & ConfigData::WarnAbout::NoAssertions ) && + ( m_config->data().warnings & ConfigData::WarnAbout::NoAssertions ) && !m_runningTest->isBranchSection() ) { m_totals.assertions.failed++; assertions.failed++; @@ -231,7 +231,7 @@ namespace Catch { } virtual bool shouldDebugBreak() const { - return m_config.shouldDebugBreak(); + return m_config->shouldDebugBreak(); } virtual std::string getCurrentTestName() const { @@ -247,7 +247,7 @@ namespace Catch { public: // !TBD We need to do this another way! bool aborting() const { - return m_totals.assertions.failed == static_cast( m_config.getCutoff() ); + return m_totals.assertions.failed == static_cast( m_config->getCutoff() ); } private: @@ -315,13 +315,13 @@ namespace Catch { RunningTest* m_runningTest; AssertionResult m_lastResult; - Config const& m_config; + Ptr m_config; Totals m_totals; Ptr m_reporter; std::vector m_messages; IRunner* m_prevRunner; IResultCapture* m_prevResultCapture; - const IConfig* m_prevConfig; + Ptr m_prevConfig; AssertionInfo m_lastAssertionInfo; std::vector m_unfinishedSections; }; diff --git a/include/reporters/catch_reporter_basic.hpp b/include/reporters/catch_reporter_basic.hpp index 13a4481f..296d4d89 100644 --- a/include/reporters/catch_reporter_basic.hpp +++ b/include/reporters/catch_reporter_basic.hpp @@ -160,7 +160,7 @@ namespace Catch { } virtual void Result( const AssertionResult& assertionResult ) { - if( !m_config.includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok ) + if( !m_config.fullConfig()->includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok ) return; startSpansLazily(); @@ -289,10 +289,10 @@ namespace Catch { void startSpansLazily() { if( !m_testingSpan.emitted ) { - if( m_config.name().empty() ) + if( m_config.fullConfig()->name().empty() ) m_config.stream() << "[Started testing]" << std::endl; 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; } diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index 658492a1..12640a2a 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -43,7 +43,7 @@ namespace Catch { AssertionResult const& result = _assertionStats.assertionResult; // 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; lazyPrint(); diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp index 7e2f4b2b..62b97a42 100644 --- a/include/reporters/catch_reporter_junit.hpp +++ b/include/reporters/catch_reporter_junit.hpp @@ -65,7 +65,7 @@ namespace Catch { }; public: - JunitReporter( const ReporterConfig& config ) + JunitReporter( ReporterConfig const& config ) : m_config( config ), m_testSuiteStats( "AllTests" ), m_currentStats( &m_testSuiteStats ) @@ -86,7 +86,7 @@ namespace Catch { virtual void StartGroup( const std::string& groupName ) { if( groupName.empty() ) - m_statsForSuites.push_back( Stats( m_config.name() ) ); + m_statsForSuites.push_back( Stats( m_config.fullConfig()->name() ) ); else m_statsForSuites.push_back( Stats( groupName ) ); m_currentStats = &m_statsForSuites.back(); @@ -110,7 +110,7 @@ namespace Catch { } 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(); TestStats stats; std::ostringstream oss; @@ -238,7 +238,6 @@ namespace Catch { private: ReporterConfig m_config; -// bool m_currentTestSuccess; Stats m_testSuiteStats; Stats* m_currentStats; diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index ae3af3c6..da040b46 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -16,7 +16,7 @@ namespace Catch { class XmlReporter : public SharedImpl { public: - XmlReporter( const ReporterConfig& config ) : m_config( config ) {} + XmlReporter( ReporterConfig const& config ) : m_config( config ) {} static std::string getDescription() { return "Reports test results as an XML document"; @@ -32,8 +32,8 @@ namespace Catch { virtual void StartTesting() { m_xml = XmlWriter( m_config.stream() ); m_xml.startElement( "Catch" ); - if( !m_config.name().empty() ) - m_xml.writeAttribute( "name", m_config.name() ); + if( !m_config.fullConfig()->name().empty() ) + m_xml.writeAttribute( "name", m_config.fullConfig()->name() ); } virtual void EndTesting( const Totals& totals ) { @@ -76,7 +76,7 @@ namespace Catch { } 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; if( assertionResult.hasExpression() ) { diff --git a/projects/SelfTest/Baselines/approvedResults.txt b/projects/SelfTest/Baselines/approvedResults.txt index e676dfb1..9330b7b2 100644 --- a/projects/SelfTest/Baselines/approvedResults.txt +++ b/projects/SelfTest/Baselines/approvedResults.txt @@ -5544,12 +5544,12 @@ with message: ------------------------------------------------------------------------------- cmdline - plain filename + arg separated by spaces ------------------------------------------------------------------------------- -CmdLineTests.cpp:416 +CmdLineTests.cpp:58 ............................................................................... -CmdLineTests.cpp:420: +CmdLineTests.cpp:62: PASSED: CHECK( config.fileName == "filename.ext" ) with expansion: @@ -5557,12 +5557,12 @@ with expansion: ------------------------------------------------------------------------------- cmdline - plain filename with colon + arg separated by colon ------------------------------------------------------------------------------- -CmdLineTests.cpp:422 +CmdLineTests.cpp:64 ............................................................................... -CmdLineTests.cpp:426: +CmdLineTests.cpp:68: PASSED: CHECK( config.fileName == "filename.ext" ) with expansion: @@ -5570,12 +5570,12 @@ with expansion: ------------------------------------------------------------------------------- cmdline - plain filename with = + arg separated by = ------------------------------------------------------------------------------- -CmdLineTests.cpp:428 +CmdLineTests.cpp:70 ............................................................................... -CmdLineTests.cpp:432: +CmdLineTests.cpp:74: PASSED: CHECK( config.fileName == "filename.ext" ) with expansion: @@ -5585,10 +5585,10 @@ with expansion: cmdline long opt ------------------------------------------------------------------------------- -CmdLineTests.cpp:434 +CmdLineTests.cpp:76 ............................................................................... -CmdLineTests.cpp:438: +CmdLineTests.cpp:80: PASSED: CHECK( config.fileName == "%stdout" ) with expansion: @@ -5598,10 +5598,10 @@ with expansion: cmdline a number ------------------------------------------------------------------------------- -CmdLineTests.cpp:445 +CmdLineTests.cpp:87 ............................................................................... -CmdLineTests.cpp:449: +CmdLineTests.cpp:91: PASSED: CHECK( config.number == 42 ) with expansion: @@ -5611,14 +5611,14 @@ with expansion: cmdline not a number ------------------------------------------------------------------------------- -CmdLineTests.cpp:451 +CmdLineTests.cpp:93 ............................................................................... -CmdLineTests.cpp:453: +CmdLineTests.cpp:95: PASSED: CHECK_THROWS( parseInto( cli, argv, config ) ) -CmdLineTests.cpp:455: +CmdLineTests.cpp:97: PASSED: CHECK( config.number == 0 ) with expansion: @@ -5628,22 +5628,22 @@ with expansion: cmdline two parsers ------------------------------------------------------------------------------- -CmdLineTests.cpp:458 +CmdLineTests.cpp:100 ............................................................................... -CmdLineTests.cpp:473: +CmdLineTests.cpp:115: PASSED: CHECK( config1.number == 42 ) with expansion: 42 == 42 -CmdLineTests.cpp:475: +CmdLineTests.cpp:117: PASSED: REQUIRE_FALSE( unusedTokens.empty() ) with expansion: !false -CmdLineTests.cpp:477: +CmdLineTests.cpp:119: PASSED: CHECK( config2.description == "some text" ) with expansion: @@ -5654,10 +5654,10 @@ cmdline methods in range ------------------------------------------------------------------------------- -CmdLineTests.cpp:486 +CmdLineTests.cpp:128 ............................................................................... -CmdLineTests.cpp:490: +CmdLineTests.cpp:132: PASSED: REQUIRE( config.index == 3 ) with expansion: @@ -5668,10 +5668,10 @@ cmdline methods out of range ------------------------------------------------------------------------------- -CmdLineTests.cpp:492 +CmdLineTests.cpp:134 ............................................................................... -CmdLineTests.cpp:495: +CmdLineTests.cpp:137: PASSED: REQUIRE_THROWS( parseInto( cli, argv, config ) ) @@ -5680,10 +5680,10 @@ cmdline flags set ------------------------------------------------------------------------------- -CmdLineTests.cpp:504 +CmdLineTests.cpp:146 ............................................................................... -CmdLineTests.cpp:508: +CmdLineTests.cpp:150: PASSED: REQUIRE( config.flag ) with expansion: @@ -5694,36 +5694,75 @@ cmdline flags not set ------------------------------------------------------------------------------- -CmdLineTests.cpp:510 +CmdLineTests.cpp:152 ............................................................................... -CmdLineTests.cpp:514: +CmdLineTests.cpp:156: PASSED: REQUIRE( config.flag == false ) with expansion: false == false --?, -h, --help display usage information --l, --list list all (or matching) test cases --t, --tags list all (or matching) tags --p, --passing show passing test output --b, --break break into debugger on failure --e, --nothrow Skip exception tests --o, --out output filename --r, --reporter e.g. console | xml | junit --n, --name suite name --a, --abort abort at first failure --x, --abortx abort after x failures --w, --warn enables warnings - which test or tests to use +usage: + testApp [ ...] [options] + +where options are: + -o, --output specifies output file + -n + + +------------------------------------------------------------------------------- +cmdline + positional +------------------------------------------------------------------------------- +CmdLineTests.cpp:159 +............................................................................... + +CmdLineTests.cpp:177: +PASSED: + REQUIRE( config.firstPos == "1st" ) +with expansion: + "1st" == "1st" + +CmdLineTests.cpp:178: +PASSED: + REQUIRE( config.secondPos == "2nd" ) +with expansion: + "2nd" == "2nd" + +CmdLineTests.cpp:179: +PASSED: + REQUIRE( config.unpositional == "3rd" ) +with expansion: + "3rd" == "3rd" + +usage: + CatchTestApp [ ...] [options] + +where options are: + -?, -h, --help display usage information + -l, --list-tests list all (or matching) test cases + -t, --list-tags list all (or matching) tags + --list-reporters list all reporters + -s, --success include successful tests in output + -b, --break break into debugger on failure + -e, --nothrow Skip exception tests + -o, --out output filename + -r, --reporter reporter to use - defaults to console + -n, --name suite name + -a, --abort abort at first failure + -x, --abortx abort after x failures + -w, --warn enable warnings + -v, --verbosity level of verbosity (0=no output) + ------------------------------------------------------------------------------- Scenario: New Catch commandline interface Given: A built cli parser for Catch - When: It is streamed + When: We ask for usage strings Then: It prints the usage strings ------------------------------------------------------------------------------- -CmdLineTests.cpp:628 +CmdLineTests.cpp:324 ............................................................................... @@ -5734,22 +5773,22 @@ Scenario: New Catch commandline interface Given: A built cli parser for Catch When: Multiple flags are combined ------------------------------------------------------------------------------- -CmdLineTests.cpp:633 +CmdLineTests.cpp:329 ............................................................................... -CmdLineTests.cpp:635: +CmdLineTests.cpp:331: PASSED: - CHECK_FALSE( config.showPassingTests ) + CHECK_FALSE( config.showSuccessfulTests ) with expansion: !false -CmdLineTests.cpp:636: +CmdLineTests.cpp:332: PASSED: CHECK_FALSE( config.noThrow ) with expansion: !false -CmdLineTests.cpp:637: +CmdLineTests.cpp:333: PASSED: CHECK_FALSE( config.breakIntoDebugger ) with expansion: @@ -5761,29 +5800,191 @@ Scenario: New Catch commandline interface When: Multiple flags are combined Then: All the flags are set ------------------------------------------------------------------------------- -CmdLineTests.cpp:642 +CmdLineTests.cpp:338 ............................................................................... -CmdLineTests.cpp:643: +CmdLineTests.cpp:339: PASSED: - CHECK( config.showPassingTests ) + CHECK( config.showSuccessfulTests ) with expansion: true -CmdLineTests.cpp:644: +CmdLineTests.cpp:340: PASSED: CHECK( config.noThrow ) with expansion: true -CmdLineTests.cpp:645: +CmdLineTests.cpp:341: PASSED: CHECK( config.breakIntoDebugger ) with expansion: true +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: Multiple flags are combined +------------------------------------------------------------------------------- +CmdLineTests.cpp:329 +............................................................................... + +CmdLineTests.cpp:331: +PASSED: + CHECK_FALSE( config.showSuccessfulTests ) +with expansion: + !false + +CmdLineTests.cpp:332: +PASSED: + CHECK_FALSE( config.noThrow ) +with expansion: + !false + +CmdLineTests.cpp:333: +PASSED: + CHECK_FALSE( config.breakIntoDebugger ) +with expansion: + !false + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: A flag is set via a nullary method +------------------------------------------------------------------------------- +CmdLineTests.cpp:344 +............................................................................... + +CmdLineTests.cpp:345: +PASSED: + CHECK( config.abortAfter == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: A flag is set via a nullary method + Then: The flag is set +------------------------------------------------------------------------------- +CmdLineTests.cpp:350 +............................................................................... + +CmdLineTests.cpp:351: +PASSED: + REQUIRE( config.abortAfter == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: A flag is set via a nullary method +------------------------------------------------------------------------------- +CmdLineTests.cpp:344 +............................................................................... + +CmdLineTests.cpp:345: +PASSED: + CHECK( config.abortAfter == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: A flag is set via a unary method +------------------------------------------------------------------------------- +CmdLineTests.cpp:353 +............................................................................... + +CmdLineTests.cpp:354: +PASSED: + CHECK( config.abortAfter == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: A flag is set via a unary method + Then: The flag is set +------------------------------------------------------------------------------- +CmdLineTests.cpp:359 +............................................................................... + +CmdLineTests.cpp:360: +PASSED: + REQUIRE( config.abortAfter == 2 ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: A flag is set via a unary method +------------------------------------------------------------------------------- +CmdLineTests.cpp:353 +............................................................................... + +CmdLineTests.cpp:354: +PASSED: + CHECK( config.abortAfter == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: A positional argument is supplied + Then: The argument is in the testOrTags collection +------------------------------------------------------------------------------- +CmdLineTests.cpp:367 +............................................................................... + +CmdLineTests.cpp:368: +PASSED: + REQUIRE( config.testsOrTags.size() == 1 ) +with expansion: + 1 == 1 + +CmdLineTests.cpp:369: +PASSED: + REQUIRE( config.testsOrTags[0] == "[hello]" ) +with expansion: + "[hello]" == "[hello]" + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: And enum opt is set by numeric value +------------------------------------------------------------------------------- +CmdLineTests.cpp:372 +............................................................................... + +CmdLineTests.cpp:373: +PASSED: + CHECK( config.verbosity == Config::Verbosity::Normal ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +Scenario: New Catch commandline interface + Given: A built cli parser for Catch + When: And enum opt is set by numeric value + Then: The member is set to the enum value +------------------------------------------------------------------------------- +CmdLineTests.cpp:378 +............................................................................... + +CmdLineTests.cpp:379: +PASSED: + REQUIRE( config.verbosity == Config::Verbosity::NoOutput ) +with expansion: + 0 == 0 + =============================================================================== -115 test cases - 50 failed (728 assertions - 107 failed) +115 test cases - 50 failed (744 assertions - 107 failed) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -6104,7 +6305,7 @@ with expansion: 13 test cases - 3 failed (40 assertions - 4 failed) - + @@ -6611,22 +6812,36 @@ TrickyTests.cpp:106 - + + +usage: + testApp <first arg> <second arg> [<any arg> ...] [options] + +where options are: + -o, --output <filename> specifies output file + -n <an integral value> + + --?, -h, --help display usage information --l, --list list all (or matching) test cases --t, --tags list all (or matching) tags --p, --passing show passing test output --b, --break break into debugger on failure --e, --nothrow Skip exception tests --o, --out <file name> output filename --r, --reporter <reporter name[:filename]> e.g. console | xml | junit --n, --name <name> suite name --a, --abort abort at first failure --x, --abortx <number of failures> abort after x failures --w, --warn <warning name> enables warnings - <test name, pattern or tags> which test or tests to use +usage: + CatchTestApp [<test name, pattern or tags> ...] [options] + +where options are: + -?, -h, --help display usage information + -l, --list-tests list all (or matching) test cases + -t, --list-tags list all (or matching) tags + --list-reporters list all reporters + -s, --success include successful tests in output + -b, --break break into debugger on failure + -e, --nothrow Skip exception tests + -o, --out <filename> output filename + -r, --reporter <name[:filename]> reporter to use - defaults to console + -n, --name <name> suite name + -a, --abort abort at first failure + -x, --abortx <number of failures> abort after x failures + -w, --warn <warning name> enable warnings + -v, --verbosity <level> level of verbosity (0=no output) @@ -6646,19 +6861,33 @@ Some information hello hello --?, -h, --help display usage information --l, --list list all (or matching) test cases --t, --tags list all (or matching) tags --p, --passing show passing test output --b, --break break into debugger on failure --e, --nothrow Skip exception tests --o, --out <file name> output filename --r, --reporter <reporter name[:filename]> e.g. console | xml | junit --n, --name <name> suite name --a, --abort abort at first failure --x, --abortx <number of failures> abort after x failures --w, --warn <warning name> enables warnings - <test name, pattern or tags> which test or tests to use +usage: + testApp <first arg> <second arg> [<any arg> ...] [options] + +where options are: + -o, --output <filename> specifies output file + -n <an integral value> + + + +usage: + CatchTestApp [<test name, pattern or tags> ...] [options] + +where options are: + -?, -h, --help display usage information + -l, --list-tests list all (or matching) test cases + -t, --list-tags list all (or matching) tags + --list-reporters list all reporters + -s, --success include successful tests in output + -b, --break break into debugger on failure + -e, --nothrow Skip exception tests + -o, --out <filename> output filename + -r, --reporter <name[:filename]> reporter to use - defaults to console + -n, --name <name> suite name + -a, --abort abort at first failure + -x, --abortx <number of failures> abort after x failures + -w, --warn <warning name> enable warnings + -v, --verbosity <level> level of verbosity (0=no output) An error @@ -12573,8 +12802,8 @@ BDDTests.cpp" line="54"> -
-CmdLineTests.cpp" line="420"> +
+CmdLineTests.cpp" line="62"> config.fileName == "filename.ext" @@ -12584,8 +12813,8 @@ CmdLineTests.cpp" line="420">
-
-CmdLineTests.cpp" line="426"> +
+CmdLineTests.cpp" line="68"> config.fileName == "filename.ext" @@ -12595,8 +12824,8 @@ CmdLineTests.cpp" line="426">
-
-CmdLineTests.cpp" line="432"> +
+CmdLineTests.cpp" line="74"> config.fileName == "filename.ext" @@ -12607,7 +12836,7 @@ CmdLineTests.cpp" line="432">
-CmdLineTests.cpp" line="438"> +CmdLineTests.cpp" line="80"> config.fileName == "%stdout" @@ -12618,7 +12847,7 @@ CmdLineTests.cpp" line="438">
-CmdLineTests.cpp" line="449"> +CmdLineTests.cpp" line="91"> config.number == 42 @@ -12629,7 +12858,7 @@ CmdLineTests.cpp" line="449">
-CmdLineTests.cpp" line="453"> +CmdLineTests.cpp" line="95"> parseInto( cli, argv, config ) @@ -12637,7 +12866,7 @@ CmdLineTests.cpp" line="453"> parseInto( cli, argv, config ) -CmdLineTests.cpp" line="455"> +CmdLineTests.cpp" line="97"> config.number == 0 @@ -12648,7 +12877,7 @@ CmdLineTests.cpp" line="455">
-CmdLineTests.cpp" line="473"> +CmdLineTests.cpp" line="115"> config1.number == 42 @@ -12656,7 +12885,7 @@ CmdLineTests.cpp" line="473"> 42 == 42 -CmdLineTests.cpp" line="475"> +CmdLineTests.cpp" line="117"> !unusedTokens.empty() @@ -12664,7 +12893,7 @@ CmdLineTests.cpp" line="475"> !false -CmdLineTests.cpp" line="477"> +CmdLineTests.cpp" line="119"> config2.description == "some text" @@ -12676,7 +12905,7 @@ CmdLineTests.cpp" line="477">
-CmdLineTests.cpp" line="490"> +CmdLineTests.cpp" line="132"> config.index == 3 @@ -12690,7 +12919,7 @@ CmdLineTests.cpp" line="490">
-CmdLineTests.cpp" line="495"> +CmdLineTests.cpp" line="137"> parseInto( cli, argv, config ) @@ -12707,7 +12936,7 @@ CmdLineTests.cpp" line="495">
-CmdLineTests.cpp" line="508"> +CmdLineTests.cpp" line="150"> config.flag @@ -12721,7 +12950,7 @@ CmdLineTests.cpp" line="508">
-CmdLineTests.cpp" line="514"> +CmdLineTests.cpp" line="156"> config.flag == false @@ -12733,11 +12962,41 @@ CmdLineTests.cpp" line="514">
+
+ +
+
+CmdLineTests.cpp" line="177"> + + config.firstPos == "1st" + + + "1st" == "1st" + + +CmdLineTests.cpp" line="178"> + + config.secondPos == "2nd" + + + "2nd" == "2nd" + + +CmdLineTests.cpp" line="179"> + + config.unpositional == "3rd" + + + "3rd" == "3rd" + + + +
-
+
@@ -12746,22 +13005,22 @@ CmdLineTests.cpp" line="514">
-
+
-CmdLineTests.cpp" line="635"> +CmdLineTests.cpp" line="331"> - !config.showPassingTests + !config.showSuccessfulTests !false -CmdLineTests.cpp" line="636"> +CmdLineTests.cpp" line="332"> !config.noThrow @@ -12769,7 +13028,7 @@ CmdLineTests.cpp" line="636"> !false -CmdLineTests.cpp" line="637"> +CmdLineTests.cpp" line="333"> !config.breakIntoDebugger @@ -12778,15 +13037,15 @@ CmdLineTests.cpp" line="637">
-CmdLineTests.cpp" line="643"> +CmdLineTests.cpp" line="339"> - config.showPassingTests + config.showSuccessfulTests true -CmdLineTests.cpp" line="644"> +CmdLineTests.cpp" line="340"> config.noThrow @@ -12794,7 +13053,7 @@ CmdLineTests.cpp" line="644"> true -CmdLineTests.cpp" line="645"> +CmdLineTests.cpp" line="341"> config.breakIntoDebugger @@ -12808,11 +13067,175 @@ CmdLineTests.cpp" line="645">
+
+
+CmdLineTests.cpp" line="331"> + + !config.showSuccessfulTests + + + !false + + +CmdLineTests.cpp" line="332"> + + !config.noThrow + + + !false + + +CmdLineTests.cpp" line="333"> + + !config.breakIntoDebugger + + + !false + + + +
+ +
+
+
+CmdLineTests.cpp" line="345"> + + config.abortAfter == 0 + + + 0 == 0 + + +
+CmdLineTests.cpp" line="351"> + + config.abortAfter == 1 + + + 1 == 1 + + + +
+ +
+ +
+
+
+CmdLineTests.cpp" line="345"> + + config.abortAfter == 0 + + + 0 == 0 + + + +
+ +
+
+
+CmdLineTests.cpp" line="354"> + + config.abortAfter == 0 + + + 0 == 0 + + +
+CmdLineTests.cpp" line="360"> + + config.abortAfter == 2 + + + 2 == 2 + + + +
+ +
+ +
+
+
+CmdLineTests.cpp" line="354"> + + config.abortAfter == 0 + + + 0 == 0 + + + +
+ +
+
+
+
+CmdLineTests.cpp" line="368"> + + config.testsOrTags.size() == 1 + + + 1 == 1 + + +CmdLineTests.cpp" line="369"> + + config.testsOrTags[0] == "[hello]" + + + "[hello]" == "[hello]" + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+CmdLineTests.cpp" line="373"> + + config.verbosity == Config::Verbosity::Normal + + + 2 == 2 + + +
+CmdLineTests.cpp" line="379"> + + config.verbosity == Config::Verbosity::NoOutput + + + 0 == 0 + + + +
+ +
+ +
- + - + [Started testing: CatchSelfTest] [Started group: '~dummy'] @@ -14659,114 +15082,201 @@ BDDTests.cpp:67: succeeded [Finished: 'Scenario: This is a really long scenario name to see how the list command deals with wrapping' All tests passed (1 assertion in 1 test case)] [Running: cmdline] -[Started section: 'plain filename'] -CmdLineTests.cpp:420: config.fileName == "filename.ext" succeeded for: "filename.ext" == "filename.ext" -[End of section: 'plain filename' 1 assertion passed] +[Started section: 'arg separated by spaces'] +CmdLineTests.cpp:62: config.fileName == "filename.ext" succeeded for: "filename.ext" == "filename.ext" +[End of section: 'arg separated by spaces' 1 assertion passed] -[Started section: 'plain filename with colon'] -CmdLineTests.cpp:426: config.fileName == "filename.ext" succeeded for: "filename.ext" == "filename.ext" -[End of section: 'plain filename with colon' 1 assertion passed] +[Started section: 'arg separated by colon'] +CmdLineTests.cpp:68: config.fileName == "filename.ext" succeeded for: "filename.ext" == "filename.ext" +[End of section: 'arg separated by colon' 1 assertion passed] -[Started section: 'plain filename with ='] -CmdLineTests.cpp:432: config.fileName == "filename.ext" succeeded for: "filename.ext" == "filename.ext" -[End of section: 'plain filename with =' 1 assertion passed] +[Started section: 'arg separated by ='] +CmdLineTests.cpp:74: config.fileName == "filename.ext" succeeded for: "filename.ext" == "filename.ext" +[End of section: 'arg separated by =' 1 assertion passed] [Started section: 'long opt'] -CmdLineTests.cpp:438: config.fileName == "%stdout" succeeded for: "%stdout" == "%stdout" +CmdLineTests.cpp:80: config.fileName == "%stdout" succeeded for: "%stdout" == "%stdout" [End of section: 'long opt' 1 assertion passed] [Started section: 'a number'] -CmdLineTests.cpp:449: config.number == 42 succeeded for: 42 == 42 +CmdLineTests.cpp:91: config.number == 42 succeeded for: 42 == 42 [End of section: 'a number' 1 assertion passed] [Started section: 'not a number'] -CmdLineTests.cpp:453: parseInto( cli, argv, config ) succeeded -CmdLineTests.cpp:455: config.number == 0 succeeded for: 0 == 0 +CmdLineTests.cpp:95: parseInto( cli, argv, config ) succeeded +CmdLineTests.cpp:97: config.number == 0 succeeded for: 0 == 0 [End of section: 'not a number' All 2 assertions passed] [Started section: 'two parsers'] -CmdLineTests.cpp:473: config1.number == 42 succeeded for: 42 == 42 -CmdLineTests.cpp:475: !unusedTokens.empty() succeeded for: !false -CmdLineTests.cpp:477: config2.description == "some text" succeeded for: "some text" == "some text" +CmdLineTests.cpp:115: config1.number == 42 succeeded for: 42 == 42 +CmdLineTests.cpp:117: !unusedTokens.empty() succeeded for: !false +CmdLineTests.cpp:119: config2.description == "some text" succeeded for: "some text" == "some text" [End of section: 'two parsers' All 3 assertions passed] [Started section: 'methods'] [Started section: 'in range'] -CmdLineTests.cpp:490: config.index == 3 succeeded for: 3 == 3 +CmdLineTests.cpp:132: config.index == 3 succeeded for: 3 == 3 [End of section: 'in range' 1 assertion passed] [End of section: 'methods' 1 assertion passed] [Started section: 'methods'] [Started section: 'out of range'] -CmdLineTests.cpp:495: parseInto( cli, argv, config ) succeeded +CmdLineTests.cpp:137: parseInto( cli, argv, config ) succeeded [End of section: 'out of range' 1 assertion passed] [End of section: 'methods' 1 assertion passed] [Started section: 'flags'] [Started section: 'set'] -CmdLineTests.cpp:508: config.flag succeeded for: true +CmdLineTests.cpp:150: config.flag succeeded for: true [End of section: 'set' 1 assertion passed] [End of section: 'flags' 1 assertion passed] [Started section: 'flags'] [Started section: 'not set'] -CmdLineTests.cpp:514: config.flag == false succeeded for: false == false +CmdLineTests.cpp:156: config.flag == false succeeded for: false == false [End of section: 'not set' 1 assertion passed] [End of section: 'flags' 1 assertion passed] -[Finished: 'cmdline' All tests passed (14 assertions in 1 test case)] --?, -h, --help display usage information --l, --list list all (or matching) test cases --t, --tags list all (or matching) tags --p, --passing show passing test output --b, --break break into debugger on failure --e, --nothrow Skip exception tests --o, --out output filename --r, --reporter e.g. console | xml | junit --n, --name suite name --a, --abort abort at first failure --x, --abortx abort after x failures --w, --warn enables warnings - which test or tests to use +usage: + testApp [ ...] [options] + +where options are: + -o, --output specifies output file + -n + + +[Started section: 'positional'] +CmdLineTests.cpp:177: config.firstPos == "1st" succeeded for: "1st" == "1st" +CmdLineTests.cpp:178: config.secondPos == "2nd" succeeded for: "2nd" == "2nd" +CmdLineTests.cpp:179: config.unpositional == "3rd" succeeded for: "3rd" == "3rd" +[End of section: 'positional' All 3 assertions passed] + +[Finished: 'cmdline' All tests passed (17 assertions in 1 test case)] +usage: + CatchTestApp [ ...] [options] + +where options are: + -?, -h, --help display usage information + -l, --list-tests list all (or matching) test cases + -t, --list-tags list all (or matching) tags + --list-reporters list all reporters + -s, --success include successful tests in output + -b, --break break into debugger on failure + -e, --nothrow Skip exception tests + -o, --out output filename + -r, --reporter reporter to use - defaults to console + -n, --name suite name + -a, --abort abort at first failure + -x, --abortx abort after x failures + -w, --warn enable warnings + -v, --verbosity level of verbosity (0=no output) + [Running: Scenario: New Catch commandline interface] [Started section: ' Given: A built cli parser for Catch'] -[Started section: ' When: It is streamed'] +[Started section: ' When: We ask for usage strings'] [Started section: ' Then: It prints the usage strings'] No assertions in section, ' Then: It prints the usage strings' [End of section: ' Then: It prints the usage strings' 1 assertion failed] -[End of section: ' When: It is streamed' 1 assertion failed] +[End of section: ' When: We ask for usage strings' 1 assertion failed] [End of section: ' Given: A built cli parser for Catch' 1 assertion failed] [Started section: ' Given: A built cli parser for Catch'] [Started section: ' When: Multiple flags are combined'] -CmdLineTests.cpp:635: !config.showPassingTests succeeded for: !false -CmdLineTests.cpp:636: !config.noThrow succeeded for: !false -CmdLineTests.cpp:637: !config.breakIntoDebugger succeeded for: !false +CmdLineTests.cpp:331: !config.showSuccessfulTests succeeded for: !false +CmdLineTests.cpp:332: !config.noThrow succeeded for: !false +CmdLineTests.cpp:333: !config.breakIntoDebugger succeeded for: !false [Started section: ' Then: All the flags are set'] -CmdLineTests.cpp:643: config.showPassingTests succeeded for: true -CmdLineTests.cpp:644: config.noThrow succeeded for: true -CmdLineTests.cpp:645: config.breakIntoDebugger succeeded for: true +CmdLineTests.cpp:339: config.showSuccessfulTests succeeded for: true +CmdLineTests.cpp:340: config.noThrow succeeded for: true +CmdLineTests.cpp:341: config.breakIntoDebugger succeeded for: true [End of section: ' Then: All the flags are set' All 3 assertions passed] [End of section: ' When: Multiple flags are combined' All 6 assertions passed] [End of section: ' Given: A built cli parser for Catch' All 6 assertions passed] -[Finished: 'Scenario: New Catch commandline interface' 1 test case failed (1 of 7 assertions failed)] -[End of group: '~dummy'. 50 of 115 test cases failed (107 of 728 assertions failed)] +[Started section: ' Given: A built cli parser for Catch'] +[Started section: ' When: Multiple flags are combined'] +CmdLineTests.cpp:331: !config.showSuccessfulTests succeeded for: !false +CmdLineTests.cpp:332: !config.noThrow succeeded for: !false +CmdLineTests.cpp:333: !config.breakIntoDebugger succeeded for: !false +[End of section: ' When: Multiple flags are combined' All 3 assertions passed] + +[End of section: ' Given: A built cli parser for Catch' All 3 assertions passed] + +[Started section: ' Given: A built cli parser for Catch'] +[Started section: ' When: A flag is set via a nullary method'] +CmdLineTests.cpp:345: config.abortAfter == 0 succeeded for: 0 == 0 +[Started section: ' Then: The flag is set'] +CmdLineTests.cpp:351: config.abortAfter == 1 succeeded for: 1 == 1 +[End of section: ' Then: The flag is set' 1 assertion passed] + +[End of section: ' When: A flag is set via a nullary method' All 2 assertions passed] + +[End of section: ' Given: A built cli parser for Catch' All 2 assertions passed] + +[Started section: ' Given: A built cli parser for Catch'] +[Started section: ' When: A flag is set via a nullary method'] +CmdLineTests.cpp:345: config.abortAfter == 0 succeeded for: 0 == 0 +[End of section: ' When: A flag is set via a nullary method' 1 assertion passed] + +[End of section: ' Given: A built cli parser for Catch' 1 assertion passed] + +[Started section: ' Given: A built cli parser for Catch'] +[Started section: ' When: A flag is set via a unary method'] +CmdLineTests.cpp:354: config.abortAfter == 0 succeeded for: 0 == 0 +[Started section: ' Then: The flag is set'] +CmdLineTests.cpp:360: config.abortAfter == 2 succeeded for: 2 == 2 +[End of section: ' Then: The flag is set' 1 assertion passed] + +[End of section: ' When: A flag is set via a unary method' All 2 assertions passed] + +[End of section: ' Given: A built cli parser for Catch' All 2 assertions passed] + +[Started section: ' Given: A built cli parser for Catch'] +[Started section: ' When: A flag is set via a unary method'] +CmdLineTests.cpp:354: config.abortAfter == 0 succeeded for: 0 == 0 +[End of section: ' When: A flag is set via a unary method' 1 assertion passed] + +[End of section: ' Given: A built cli parser for Catch' 1 assertion passed] + +[Started section: ' Given: A built cli parser for Catch'] +[Started section: ' When: A positional argument is supplied'] +[Started section: ' Then: The argument is in the testOrTags collection'] +CmdLineTests.cpp:368: config.testsOrTags.size() == 1 succeeded for: 1 == 1 +CmdLineTests.cpp:369: config.testsOrTags[0] == "[hello]" succeeded for: "[hello]" == "[hello]" +[End of section: ' Then: The argument is in the testOrTags collection' All 2 assertions passed] + +[End of section: ' When: A positional argument is supplied' All 2 assertions passed] + +[End of section: ' Given: A built cli parser for Catch' All 2 assertions passed] + +[Started section: ' Given: A built cli parser for Catch'] +[Started section: ' When: And enum opt is set by numeric value'] +CmdLineTests.cpp:373: config.verbosity == Config::Verbosity::Normal succeeded for: 2 == 2 +[Started section: ' Then: The member is set to the enum value'] +CmdLineTests.cpp:379: config.verbosity == Config::Verbosity::NoOutput succeeded for: 0 == 0 +[End of section: ' Then: The member is set to the enum value' 1 assertion passed] + +[End of section: ' When: And enum opt is set by numeric value' All 2 assertions passed] + +[End of section: ' Given: A built cli parser for Catch' All 2 assertions passed] + +[Finished: 'Scenario: New Catch commandline interface' 1 test case failed (1 of 20 assertions failed)] +[End of group: '~dummy'. 50 of 115 test cases failed (107 of 744 assertions failed)] -[Testing completed. 50 of 115 test cases failed (107 of 728 assertions failed)] +[Testing completed. 50 of 115 test cases failed (107 of 744 assertions failed)] [Started testing: CatchSelfTest] [Started group: '~dummy'] diff --git a/projects/SelfTest/catch_self_test.cpp b/projects/SelfTest/catch_self_test.cpp index 9bd40b5a..af26510f 100644 --- a/projects/SelfTest/catch_self_test.cpp +++ b/projects/SelfTest/catch_self_test.cpp @@ -15,8 +15,8 @@ namespace Catch{ Totals EmbeddedRunner::runMatching( const std::string& rawTestSpec, std::size_t groupIndex, std::size_t groupsCount, const std::string& ) { std::ostringstream oss; - Config config; - config.setStreamBuf( oss.rdbuf() ); + Ptr config = new Config(); + config->setStreamBuf( oss.rdbuf() ); Totals totals;