Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhil Nash2013-01-14 18:58:50 +0000
committerPhil Nash2013-01-14 18:58:50 +0000
commit3b970e20e9effbcafc5f6490998ff9ef68cfe9ec (patch)
treed39963f92b5cef2bd258900d3b0e683026bf47d2
parent60ed3c142c2e7394f7cef9936f5b55b7b1057822 (diff)
downloadcatch3-3b970e20e9effbcafc5f6490998ff9ef68cfe9ec.tar.gz
Refactored printResultType into switch
-rw-r--r--include/reporters/catch_reporter_console.hpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index ee9f5fa7..c9ef00ee 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -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;
}