Squashed commit of the following:
commit2a1e8bfc6e
Author: Phil Nash <github@philnash.me> Date: Thu Nov 1 08:16:15 2012 +0000 Updated colour comments commitf0f407fc3e
Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:28:21 2012 +0000 Manually applied merge #133 from Master commit355b95fda1
Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:04:22 2012 +0000 Cleaned up ANSI colour code impl a bit commit778f9c4fc7
Author: Phil Nash <github@philnash.me> Date: Tue Oct 30 09:09:30 2012 +0000 Removed "no-" from Wno-global-constructors when disabling commit5efa4bcb8a
Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:49:22 2012 +0000 Regenerated single_include commit108f1937d8
Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:46:45 2012 +0000 Added terminal colour codes for POSIX With thanks to Adam Strzelecki commit8f4cc541d5
Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:34 2012 +0000 Added regression test baselines commit2e203a1834
Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:13 2012 +0000 Fixed remaining reporting regressions commit134e45b3ad
Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 20:57:21 2012 +0000 Fixed #132 commit2f92db9898
Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:15:34 2012 +0000 Updated the readme specifically for the Integration branch commit82acc2ca05
Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:07:17 2012 +0000 Regenerated single include commitfe1d7c1d08
Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 10:27:44 2012 +0000 Small fixes and tweaks commit355b5e546d
Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 09:05:36 2012 +0100 Some tidy-up commitf847186ebb
Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 08:45:23 2012 +0100 AssertionResultBuilder -> ExpressionResultBuilder commit8cca2f1369
Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 22:09:01 2012 +0100 ExpressionBuilder ->ExpressionDecomposer Expression -> ExpressionLhs commite04e74f896
Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 21:59:47 2012 +0100 More AssertionResult refactoring commit1dd56d4d2b
Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:34 2012 +0100 AssertionResultBuilder can be constructed from result type commitf2d5f1b3e4
Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:05 2012 +0100 Expression has its own result builder - not passed in from expression builder commite3b111a39a
Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 22:59:16 2012 +0100 streamlined acceptResult commit3ad13256e1
Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 08:39:44 2012 +0100 Refactored assertion builder stuff out of expression builder commitc96f9330a0
Author: Phil Nash <github@philnash.me> Date: Wed Oct 17 08:14:22 2012 +0100 Collect assertion info up front commita5fa78284d
Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:33:13 2012 +0100 ResultData -> AssertionResultData commitc597a893fa
Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:31:05 2012 +0100 ResultInfo -> AssertionResult filenames and variables commitd16955f63a
Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:27:21 2012 +0100 Renamed ResultInfo -> AssertionResult commit175da3ef64
Author: Phil Nash <github@philnash.me> Date: Fri Oct 12 18:39:22 2012 +0100 regen test 3
This commit is contained in:
parent
b18d719f9d
commit
ce612bf656
34 changed files with 2202 additions and 1389 deletions
|
@ -109,7 +109,7 @@ namespace Catch {
|
|||
|
||||
do {
|
||||
do {
|
||||
m_currentResult.setLineInfo( m_runningTest->getTestCaseInfo().getLineInfo() );
|
||||
m_assertionInfo.lineInfo = m_runningTest->getTestCaseInfo().getLineInfo();
|
||||
runCurrentTest( redirectedCout, redirectedCerr );
|
||||
}
|
||||
while( m_runningTest->hasUntestedSections() && !aborting() );
|
||||
|
@ -131,25 +131,17 @@ namespace Catch {
|
|||
|
||||
private: // IResultCapture
|
||||
|
||||
virtual ResultAction::Value acceptResult( bool result ) {
|
||||
return acceptResult( result ? ResultWas::Ok : ResultWas::ExpressionFailed );
|
||||
virtual void acceptAssertionInfo( const AssertionInfo& assertionInfo ) {
|
||||
m_assertionInfo = assertionInfo;
|
||||
}
|
||||
|
||||
virtual ResultAction::Value acceptResult( ResultWas::OfType result ) {
|
||||
m_currentResult.setResultType( result );
|
||||
|
||||
virtual ResultAction::Value acceptExpression( const ExpressionResultBuilder& assertionResult, const AssertionInfo& assertionInfo ) {
|
||||
m_assertionInfo = assertionInfo;
|
||||
m_currentResult = assertionResult;
|
||||
return actOnCurrentResult();
|
||||
}
|
||||
|
||||
virtual ResultAction::Value acceptExpression( const ResultInfoBuilder& resultInfo ) {
|
||||
m_currentResult = resultInfo;
|
||||
return actOnCurrentResult();
|
||||
}
|
||||
|
||||
virtual void acceptMessage( const std::string& msg ) {
|
||||
m_currentResult.setMessage( msg );
|
||||
}
|
||||
|
||||
virtual void testEnded( const ResultInfo& result ) {
|
||||
virtual void testEnded( const AssertionResult& result ) {
|
||||
if( result.getResultType() == ResultWas::Ok ) {
|
||||
m_totals.assertions.passed++;
|
||||
}
|
||||
|
@ -160,19 +152,19 @@ namespace Catch {
|
|||
std::vector<ScopedInfo*>::const_iterator it = m_scopedInfos.begin();
|
||||
std::vector<ScopedInfo*>::const_iterator itEnd = m_scopedInfos.end();
|
||||
for(; it != itEnd; ++it )
|
||||
m_reporter->Result( (*it)->getInfo() );
|
||||
m_reporter->Result( (*it)->buildResult( m_assertionInfo ) );
|
||||
}
|
||||
{
|
||||
std::vector<ResultInfo>::const_iterator it = m_info.begin();
|
||||
std::vector<ResultInfo>::const_iterator itEnd = m_info.end();
|
||||
std::vector<AssertionResult>::const_iterator it = m_assertionResults.begin();
|
||||
std::vector<AssertionResult>::const_iterator itEnd = m_assertionResults.end();
|
||||
for(; it != itEnd; ++it )
|
||||
m_reporter->Result( *it );
|
||||
}
|
||||
m_info.clear();
|
||||
m_assertionResults.clear();
|
||||
}
|
||||
|
||||
if( result.getResultType() == ResultWas::Info )
|
||||
m_info.push_back( result );
|
||||
m_assertionResults.push_back( result );
|
||||
else
|
||||
m_reporter->Result( result );
|
||||
}
|
||||
|
@ -190,7 +182,7 @@ namespace Catch {
|
|||
if( !m_runningTest->addSection( oss.str() ) )
|
||||
return false;
|
||||
|
||||
m_currentResult.setLineInfo( lineInfo );
|
||||
m_assertionInfo.lineInfo = lineInfo;
|
||||
m_reporter->StartSection( name, description );
|
||||
assertions = m_totals.assertions;
|
||||
|
||||
|
@ -229,7 +221,7 @@ namespace Catch {
|
|||
: "";
|
||||
}
|
||||
|
||||
virtual const ResultInfo* getLastResult() const {
|
||||
virtual const AssertionResult* getLastResult() const {
|
||||
return &m_lastResult;
|
||||
}
|
||||
|
||||
|
@ -242,10 +234,11 @@ namespace Catch {
|
|||
private:
|
||||
|
||||
ResultAction::Value actOnCurrentResult() {
|
||||
m_lastResult = m_currentResult.build();
|
||||
m_lastResult = m_currentResult.buildResult( m_assertionInfo );
|
||||
testEnded( m_lastResult );
|
||||
|
||||
m_currentResult = ResultInfoBuilder();
|
||||
m_currentResult = ExpressionResultBuilder();
|
||||
m_assertionInfo = AssertionInfo();
|
||||
|
||||
ResultAction::Value action = ResultAction::None;
|
||||
|
||||
|
@ -284,26 +277,29 @@ namespace Catch {
|
|||
// This just means the test was aborted due to failure
|
||||
}
|
||||
catch(...) {
|
||||
acceptMessage( getRegistryHub().getExceptionTranslatorRegistry().translateActiveException() );
|
||||
acceptResult( ResultWas::ThrewException );
|
||||
m_currentResult
|
||||
.setResultType( ResultWas::ThrewException )
|
||||
<< translateActiveException();
|
||||
actOnCurrentResult();
|
||||
}
|
||||
m_info.clear();
|
||||
m_assertionResults.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
IMutableContext& m_context;
|
||||
RunningTest* m_runningTest;
|
||||
ResultInfoBuilder m_currentResult;
|
||||
ResultInfo m_lastResult;
|
||||
ExpressionResultBuilder m_currentResult;
|
||||
AssertionResult m_lastResult;
|
||||
|
||||
const Config& m_config;
|
||||
Totals m_totals;
|
||||
Ptr<IReporter> m_reporter;
|
||||
std::vector<ScopedInfo*> m_scopedInfos;
|
||||
std::vector<ResultInfo> m_info;
|
||||
std::vector<AssertionResult> m_assertionResults;
|
||||
IRunner* m_prevRunner;
|
||||
IResultCapture* m_prevResultCapture;
|
||||
const IConfig* m_prevConfig;
|
||||
AssertionInfo m_assertionInfo;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue