Refactored printResultType into switch

This commit is contained in:
Phil Nash 2013-01-14 18:58:50 +00:00
parent 60ed3c142c
commit 3b970e20e9

View File

@ -61,14 +61,18 @@ namespace Catch {
} }
bool printResultType( AssertionResult const& _result ) { bool printResultType( AssertionResult const& _result ) {
if( _result.getResultType() == ResultWas::Info || switch( _result.getResultType() ) {
_result.getResultType() == ResultWas::Warning ) { case ResultWas::Info:
} case ResultWas::Warning:
else if( _result.succeeded() ) { break;
case ResultWas::Ok:
{
TextColour successColour( TextColour::Success ); TextColour successColour( TextColour::Success );
stream << "passed "; stream << "passed ";
} }
else if( _result.isOk() ) { break;
default:
if( _result.isOk() ) {
TextColour okAnywayColour( TextColour::Success ); TextColour okAnywayColour( TextColour::Success );
stream << "failed - but was ok "; stream << "failed - but was ok ";
} }
@ -76,6 +80,7 @@ namespace Catch {
TextColour errorColour( TextColour::Error ); TextColour errorColour( TextColour::Error );
stream << "failed "; stream << "failed ";
} }
}
return false; return false;
} }
bool printOriginalExpression( AssertionResult const& _result ) { bool printOriginalExpression( AssertionResult const& _result ) {