Squashed commit of the following:

commit 2a1e8bfc6e
Author: Phil Nash <github@philnash.me>
Date:   Thu Nov 1 08:16:15 2012 +0000

    Updated colour comments

commit f0f407fc3e
Author: Phil Nash <github@philnash.me>
Date:   Wed Oct 31 18:28:21 2012 +0000

    Manually applied merge #133 from Master

commit 355b95fda1
Author: Phil Nash <github@philnash.me>
Date:   Wed Oct 31 18:04:22 2012 +0000

    Cleaned up ANSI colour code impl a bit

commit 778f9c4fc7
Author: Phil Nash <github@philnash.me>
Date:   Tue Oct 30 09:09:30 2012 +0000

    Removed "no-" from Wno-global-constructors when disabling

commit 5efa4bcb8a
Author: Phil Nash <github@philnash.me>
Date:   Mon Oct 29 20:49:22 2012 +0000

    Regenerated single_include

commit 108f1937d8
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

commit 8f4cc541d5
Author: Phil Nash <github@philnash.me>
Date:   Mon Oct 29 19:55:34 2012 +0000

    Added regression test baselines

commit 2e203a1834
Author: Phil Nash <github@philnash.me>
Date:   Mon Oct 29 19:55:13 2012 +0000

    Fixed remaining reporting regressions

commit 134e45b3ad
Author: Phil Nash <github@philnash.me>
Date:   Sun Oct 28 20:57:21 2012 +0000

    Fixed #132

commit 2f92db9898
Author: Phil Nash <github@philnash.me>
Date:   Sun Oct 28 12:15:34 2012 +0000

    Updated the readme specifically for the Integration branch

commit 82acc2ca05
Author: Phil Nash <github@philnash.me>
Date:   Sun Oct 28 12:07:17 2012 +0000

    Regenerated single include

commit fe1d7c1d08
Author: Phil Nash <github@philnash.me>
Date:   Sun Oct 28 10:27:44 2012 +0000

    Small fixes and tweaks

commit 355b5e546d
Author: Phil Nash <github@philnash.me>
Date:   Fri Oct 26 09:05:36 2012 +0100

    Some tidy-up

commit f847186ebb
Author: Phil Nash <github@philnash.me>
Date:   Fri Oct 26 08:45:23 2012 +0100

    AssertionResultBuilder -> ExpressionResultBuilder

commit 8cca2f1369
Author: Phil Nash <github@philnash.me>
Date:   Wed Oct 24 22:09:01 2012 +0100

    ExpressionBuilder ->ExpressionDecomposer
    Expression -> ExpressionLhs

commit e04e74f896
Author: Phil Nash <github@philnash.me>
Date:   Wed Oct 24 21:59:47 2012 +0100

    More AssertionResult refactoring

commit 1dd56d4d2b
Author: Phil Nash <github@philnash.me>
Date:   Fri Oct 19 08:01:34 2012 +0100

    AssertionResultBuilder can be constructed from result type

commit f2d5f1b3e4
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

commit e3b111a39a
Author: Phil Nash <github@philnash.me>
Date:   Thu Oct 18 22:59:16 2012 +0100

    streamlined acceptResult

commit 3ad13256e1
Author: Phil Nash <github@philnash.me>
Date:   Thu Oct 18 08:39:44 2012 +0100

    Refactored assertion builder stuff out of expression builder

commit c96f9330a0
Author: Phil Nash <github@philnash.me>
Date:   Wed Oct 17 08:14:22 2012 +0100

    Collect assertion info up front

commit a5fa78284d
Author: Phil Nash <github@philnash.me>
Date:   Tue Oct 16 08:33:13 2012 +0100

    ResultData -> AssertionResultData

commit c597a893fa
Author: Phil Nash <github@philnash.me>
Date:   Tue Oct 16 08:31:05 2012 +0100

    ResultInfo -> AssertionResult filenames and variables

commit d16955f63a
Author: Phil Nash <github@philnash.me>
Date:   Tue Oct 16 08:27:21 2012 +0100

    Renamed ResultInfo -> AssertionResult

commit 175da3ef64
Author: Phil Nash <github@philnash.me>
Date:   Fri Oct 12 18:39:22 2012 +0100

    regen test 3
This commit is contained in:
Phil Nash
2012-11-01 08:27:09 +00:00
parent b18d719f9d
commit ce612bf656
34 changed files with 2202 additions and 1389 deletions

View File

@@ -159,21 +159,21 @@ namespace Catch {
m_sectionSpans.pop_back();
}
virtual void Result( const ResultInfo& resultInfo ) {
if( !m_config.includeSuccessfulResults && resultInfo.getResultType() == ResultWas::Ok )
virtual void Result( const AssertionResult& assertionResult ) {
if( !m_config.includeSuccessfulResults && assertionResult.getResultType() == ResultWas::Ok )
return;
startSpansLazily();
if( !resultInfo.getFilename().empty() ) {
if( !assertionResult.getSourceInfo().empty() ) {
TextColour colour( TextColour::FileName );
m_config.stream << SourceLineInfo( resultInfo.getFilename(), resultInfo.getLine() );
m_config.stream << assertionResult.getSourceInfo();
}
if( resultInfo.hasExpression() ) {
if( assertionResult.hasExpression() ) {
TextColour colour( TextColour::OriginalExpression );
m_config.stream << resultInfo.getExpression();
if( resultInfo.ok() ) {
m_config.stream << assertionResult.getExpression();
if( assertionResult.ok() ) {
TextColour successColour( TextColour::Success );
m_config.stream << " succeeded";
}
@@ -182,45 +182,51 @@ namespace Catch {
m_config.stream << " failed";
}
}
switch( resultInfo.getResultType() ) {
switch( assertionResult.getResultType() ) {
case ResultWas::ThrewException:
{
TextColour colour( TextColour::Error );
if( resultInfo.hasExpression() )
m_config.stream << " with unexpected";
else
m_config.stream << "Unexpected";
m_config.stream << " exception with message: '" << resultInfo.getMessage() << "'";
}
{
TextColour colour( TextColour::Error );
if( assertionResult.hasExpression() )
m_config.stream << " with unexpected";
else
m_config.stream << "Unexpected";
m_config.stream << " exception with message: '" << assertionResult.getMessage() << "'";
}
break;
case ResultWas::DidntThrowException:
{
TextColour colour( TextColour::Error );
if( resultInfo.hasExpression() )
m_config.stream << " because no exception was thrown where one was expected";
else
m_config.stream << "No exception thrown where one was expected";
}
{
TextColour colour( TextColour::Error );
if( assertionResult.hasExpression() )
m_config.stream << " because no exception was thrown where one was expected";
else
m_config.stream << "No exception thrown where one was expected";
}
break;
case ResultWas::Info:
streamVariableLengthText( "info", resultInfo.getMessage() );
{
TextColour colour( TextColour::ReconstructedExpression );
streamVariableLengthText( "info", assertionResult.getMessage() );
}
break;
case ResultWas::Warning:
m_config.stream << "warning:\n'" << resultInfo.getMessage() << "'";
{
TextColour colour( TextColour::ReconstructedExpression );
streamVariableLengthText( "warning", assertionResult.getMessage() );
}
break;
case ResultWas::ExplicitFailure:
{
TextColour colour( TextColour::Error );
m_config.stream << "failed with message: '" << resultInfo.getMessage() << "'";
}
{
TextColour colour( TextColour::Error );
m_config.stream << "failed with message: '" << assertionResult.getMessage() << "'";
}
break;
case ResultWas::Unknown: // These cases are here to prevent compiler warnings
case ResultWas::Ok:
case ResultWas::FailureBit:
case ResultWas::ExpressionFailed:
case ResultWas::Exception:
if( !resultInfo.hasExpression() ) {
if( resultInfo.ok() ) {
if( !assertionResult.hasExpression() ) {
if( assertionResult.ok() ) {
TextColour colour( TextColour::Success );
m_config.stream << " succeeded";
}
@@ -232,14 +238,15 @@ namespace Catch {
break;
}
if( resultInfo.hasExpandedExpression() ) {
if( assertionResult.hasExpandedExpression() ) {
m_config.stream << " for: ";
if( resultInfo.getExpandedExpression().size() > 40 )
if( assertionResult.getExpandedExpression().size() > 40 ) {
m_config.stream << "\n";
if( resultInfo.getExpandedExpression().size() < 70 )
m_config.stream << "\t";
if( assertionResult.getExpandedExpression().size() < 70 )
m_config.stream << "\t";
}
TextColour colour( TextColour::ReconstructedExpression );
m_config.stream << resultInfo.getExpandedExpression();
m_config.stream << assertionResult.getExpandedExpression();
}
m_config.stream << std::endl;
}
@@ -309,7 +316,7 @@ namespace Catch {
void streamVariableLengthText( const std::string& prefix, const std::string& text ) {
std::string trimmed = trim( text );
if( trimmed.find_first_of( "\r\n" ) == std::string::npos ) {
m_config.stream << "[" << prefix << ": " << trimmed << "]\n";
m_config.stream << "[" << prefix << ": " << trimmed << "]";
}
else {
m_config.stream << "\n[" << prefix << "] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" << trimmed

View File

@@ -97,19 +97,19 @@ namespace Catch {
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getName() ) );
}
virtual void Result( const Catch::ResultInfo& resultInfo ) {
if( resultInfo.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults ) {
virtual void Result( const Catch::AssertionResult& assertionResult ) {
if( assertionResult.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults ) {
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
TestStats stats;
std::ostringstream oss;
if( !resultInfo.getMessage().empty() )
oss << resultInfo.getMessage() << " at ";
oss << SourceLineInfo( resultInfo.getFilename(), resultInfo.getLine() );
if( !assertionResult.getMessage().empty() )
oss << assertionResult.getMessage() << " at ";
oss << assertionResult.getSourceInfo();
stats.m_content = oss.str();
stats.m_message = resultInfo.getExpandedExpression();
stats.m_resultType = resultInfo.getTestMacroName();
stats.m_message = assertionResult.getExpandedExpression();
stats.m_resultType = assertionResult.getTestMacroName();
switch( resultInfo.getResultType() ) {
switch( assertionResult.getResultType() ) {
case ResultWas::ThrewException:
stats.m_element = "error";
m_currentStats->m_errorsCount++;

View File

@@ -75,42 +75,42 @@ namespace Catch {
m_currentTestSuccess = true;
}
virtual void Result( const Catch::ResultInfo& resultInfo ) {
if( !m_config.includeSuccessfulResults && resultInfo.getResultType() == ResultWas::Ok )
virtual void Result( const Catch::AssertionResult& assertionResult ) {
if( !m_config.includeSuccessfulResults && assertionResult.getResultType() == ResultWas::Ok )
return;
if( resultInfo.hasExpression() ) {
if( assertionResult.hasExpression() ) {
m_xml.startElement( "Expression" )
.writeAttribute( "success", resultInfo.ok() )
.writeAttribute( "filename", resultInfo.getFilename() )
.writeAttribute( "line", resultInfo.getLine() );
.writeAttribute( "success", assertionResult.ok() )
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
.writeAttribute( "line", assertionResult.getSourceInfo().line );
m_xml.scopedElement( "Original" )
.writeText( resultInfo.getExpression() );
.writeText( assertionResult.getExpression() );
m_xml.scopedElement( "Expanded" )
.writeText( resultInfo.getExpandedExpression() );
m_currentTestSuccess &= resultInfo.ok();
.writeText( assertionResult.getExpandedExpression() );
m_currentTestSuccess &= assertionResult.ok();
}
switch( resultInfo.getResultType() ) {
switch( assertionResult.getResultType() ) {
case ResultWas::ThrewException:
m_xml.scopedElement( "Exception" )
.writeAttribute( "filename", resultInfo.getFilename() )
.writeAttribute( "line", resultInfo.getLine() )
.writeText( resultInfo.getMessage() );
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
.writeAttribute( "line", assertionResult.getSourceInfo().line )
.writeText( assertionResult.getMessage() );
m_currentTestSuccess = false;
break;
case ResultWas::Info:
m_xml.scopedElement( "Info" )
.writeText( resultInfo.getMessage() );
.writeText( assertionResult.getMessage() );
break;
case ResultWas::Warning:
m_xml.scopedElement( "Warning" )
.writeText( resultInfo.getMessage() );
.writeText( assertionResult.getMessage() );
break;
case ResultWas::ExplicitFailure:
m_xml.scopedElement( "Failure" )
.writeText( resultInfo.getMessage() );
.writeText( assertionResult.getMessage() );
m_currentTestSuccess = false;
break;
case ResultWas::Unknown:
@@ -121,7 +121,7 @@ namespace Catch {
case ResultWas::DidntThrowException:
break;
}
if( resultInfo.hasExpression() )
if( assertionResult.hasExpression() )
m_xml.endElement();
}