This commit is contained in:
Phil Nash 2012-11-21 18:06:13 +00:00
parent fe6d1a5838
commit 2846367109
3 changed files with 41 additions and 18 deletions

2
README
View File

@ -1,4 +1,4 @@
CATCH v0.9 build 5 (integration branch) CATCH v0.9 build 6 (integration branch)
--------------------------------------------- ---------------------------------------------
CATCH is an automated test framework for C, C++ and Objective-C. CATCH is an automated test framework for C, C++ and Objective-C.

View File

@ -13,7 +13,7 @@
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion = { 0, 9, 5, "integration" }; Version libraryVersion = { 0, 9, 6, "integration" };
} }
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -1,6 +1,6 @@
/* /*
* CATCH v0.9 build 5 (integration branch) * CATCH v0.9 build 6 (integration branch)
* Generated: 2012-11-19 19:58:11.700412 * Generated: 2012-11-21 18:04:49.655014
* ---------------------------------------------------------- * ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly * This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -1041,17 +1041,19 @@ public:
namespace Catch { namespace Catch {
struct Counts { struct Counts {
Counts() : passed( 0 ), failed( 0 ) {} Counts() : passed( 0 ), failed( 0 ), info( 0 ) {}
Counts operator - ( const Counts& other ) const { Counts operator - ( const Counts& other ) const {
Counts diff; Counts diff;
diff.passed = passed - other.passed; diff.passed = passed - other.passed;
diff.failed = failed - other.failed; diff.failed = failed - other.failed;
diff.info = info - other.info;
return diff; return diff;
} }
Counts& operator += ( const Counts& other ) { Counts& operator += ( const Counts& other ) {
passed += other.passed; passed += other.passed;
failed += other.failed; failed += other.failed;
info += other.info;
return *this; return *this;
} }
@ -1061,6 +1063,7 @@ namespace Catch {
std::size_t passed; std::size_t passed;
std::size_t failed; std::size_t failed;
std::size_t info;
}; };
struct Totals { struct Totals {
@ -3988,12 +3991,20 @@ namespace Catch {
} }
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() ); while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
Totals deltaTotals = m_totals.delta( prevTotals );
if( deltaTotals.assertions.total() == 0 &&
( m_config.data().warnings & ConfigData::WarnAbout::NoAssertions ) ) {
m_totals.assertions.failed++;
deltaTotals = m_totals.delta( prevTotals );
m_reporter->NoAssertionsInTestCase( m_runningTest->getTestCaseInfo().getName() );
}
m_totals.testCases += deltaTotals.testCases;
m_reporter->EndTestCase( testInfo, deltaTotals, redirectedCout, redirectedCerr );
delete m_runningTest; delete m_runningTest;
m_runningTest = NULL; m_runningTest = NULL;
Totals deltaTotals = m_totals.delta( prevTotals );
m_totals.testCases += deltaTotals.testCases;
m_reporter->EndTestCase( testInfo, deltaTotals, redirectedCout, redirectedCerr );
return deltaTotals; return deltaTotals;
} }
@ -4031,7 +4042,10 @@ namespace Catch {
} }
if( result.getResultType() == ResultWas::Info ) if( result.getResultType() == ResultWas::Info )
{
m_assertionResults.push_back( result ); m_assertionResults.push_back( result );
m_totals.assertions.info++;
}
else else
m_reporter->Result( result ); m_reporter->Result( result );
@ -4062,7 +4076,7 @@ namespace Catch {
virtual void sectionEnded( const std::string& name, const Counts& prevAssertions ) { virtual void sectionEnded( const std::string& name, const Counts& prevAssertions ) {
Counts assertions = m_totals.assertions - prevAssertions; Counts assertions = m_totals.assertions - prevAssertions;
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_reporter->NoAssertionsInSection( name ); m_reporter->NoAssertionsInSection( name );
@ -4124,7 +4138,6 @@ namespace Catch {
try { try {
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", m_runningTest->getTestCaseInfo().getLineInfo(), "", ResultDisposition::Normal ); m_lastAssertionInfo = AssertionInfo( "TEST_CASE", m_runningTest->getTestCaseInfo().getLineInfo(), "", ResultDisposition::Normal );
m_runningTest->reset(); m_runningTest->reset();
Counts prevAssertions = m_totals.assertions;
if( m_reporter->shouldRedirectStdout() ) { if( m_reporter->shouldRedirectStdout() ) {
StreamRedirect coutRedir( std::cout, redirectedCout ); StreamRedirect coutRedir( std::cout, redirectedCout );
StreamRedirect cerrRedir( std::cerr, redirectedCerr ); StreamRedirect cerrRedir( std::cerr, redirectedCerr );
@ -4133,13 +4146,6 @@ namespace Catch {
else { else {
m_runningTest->getTestCaseInfo().invoke(); m_runningTest->getTestCaseInfo().invoke();
} }
Counts assertions = m_totals.assertions - prevAssertions;
if( assertions.total() == 0 &&
( m_config.data().warnings & ConfigData::WarnAbout::NoAssertions ) &&
!m_runningTest->hasSections() ) {
m_totals.assertions.failed++;
m_reporter->NoAssertionsInTestCase( m_runningTest->getTestCaseInfo().getName() );
}
m_runningTest->ranToCompletion(); m_runningTest->ranToCompletion();
} }
catch( TestFailureException& ) { catch( TestFailureException& ) {
@ -5379,7 +5385,7 @@ namespace Catch {
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion = { 0, 9, 5, "integration" }; Version libraryVersion = { 0, 9, 6, "integration" };
} }
// #included from: ../reporters/catch_reporter_basic.hpp // #included from: ../reporters/catch_reporter_basic.hpp
@ -5645,6 +5651,11 @@ namespace Catch {
} }
} }
} }
if( assertionResult.hasMessage() ) {
m_config.stream << "\n";
TextColour colour( TextColour::ReconstructedExpression );
streamVariableLengthText( "with message", assertionResult.getMessage() );
}
break; break;
} }
@ -6107,6 +6118,8 @@ namespace Catch {
std::string m_status; std::string m_status;
std::string m_className; std::string m_className;
std::string m_name; std::string m_name;
std::string m_stdOut;
std::string m_stdErr;
std::vector<TestStats> m_testStats; std::vector<TestStats> m_testStats;
}; };
@ -6220,6 +6233,9 @@ namespace Catch {
} }
virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals&, const std::string& stdOut, const std::string& stdErr ) { virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals&, const std::string& stdOut, const std::string& stdErr ) {
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
testCaseStats.m_stdOut = stdOut;
testCaseStats.m_stdErr = stdErr;
if( !stdOut.empty() ) if( !stdOut.empty() )
m_stdOut << stdOut << "\n"; m_stdOut << stdOut << "\n";
if( !stdErr.empty() ) if( !stdErr.empty() )
@ -6270,6 +6286,13 @@ namespace Catch {
xml.writeAttribute( "time", "tbd" ); xml.writeAttribute( "time", "tbd" );
OutputTestResult( xml, *it ); OutputTestResult( xml, *it );
std::string stdOut = trim( it->m_stdOut );
if( !stdOut.empty() )
xml.scopedElement( "system-out" ).writeText( stdOut );
std::string stdErr = trim( it->m_stdErr );
if( !stdErr.empty() )
xml.scopedElement( "system-err" ).writeText( stdErr );
} }
} }