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