Adjusted some elements of style in compact_reporter

This commit is contained in:
Phil Nash 2014-05-01 19:03:56 +01:00
parent c02c7003dc
commit 4e9484ba30

View File

@ -246,7 +246,7 @@ namespace Catch {
// - red: Failed N tests cases, failed M assertions. // - red: Failed N tests cases, failed M assertions.
// - green: Passed [both/all] N tests cases with M assertions. // - green: Passed [both/all] N tests cases with M assertions.
std::string both_or_all( int count ) const { std::string bothOrAll( std::size_t count ) const {
return count == 1 ? "" : count == 2 ? "both " : "all " ; return count == 1 ? "" : count == 2 ? "both " : "all " ;
} }
@ -258,16 +258,16 @@ namespace Catch {
Colour colour( Colour::ResultError ); Colour colour( Colour::ResultError );
const std::string qualify_assertions_failed = const std::string qualify_assertions_failed =
totals.assertions.failed == totals.assertions.total() ? totals.assertions.failed == totals.assertions.total() ?
both_or_all( totals.assertions.failed ) : ""; bothOrAll( totals.assertions.failed ) : "";
stream << stream <<
"Failed " << both_or_all( totals.testCases.failed ) "Failed " << bothOrAll( totals.testCases.failed )
<< pluralise( totals.testCases.failed, "test case" ) << ", " << pluralise( totals.testCases.failed, "test case" ) << ", "
"failed " << qualify_assertions_failed << "failed " << qualify_assertions_failed <<
pluralise( totals.assertions.failed, "assertion" ) << "."; pluralise( totals.assertions.failed, "assertion" ) << ".";
} }
else if( totals.assertions.total() == 0 ) { else if( totals.assertions.total() == 0 ) {
stream << stream <<
"Passed " << both_or_all( totals.testCases.total() ) "Passed " << bothOrAll( totals.testCases.total() )
<< pluralise( totals.testCases.total(), "test case" ) << pluralise( totals.testCases.total(), "test case" )
<< " (no assertions)."; << " (no assertions).";
} }
@ -280,7 +280,7 @@ namespace Catch {
else { else {
Colour colour( Colour::ResultSuccess ); Colour colour( Colour::ResultSuccess );
stream << stream <<
"Passed " << both_or_all( totals.testCases.passed ) "Passed " << bothOrAll( totals.testCases.passed )
<< pluralise( totals.testCases.passed, "test case" ) << << pluralise( totals.testCases.passed, "test case" ) <<
" with " << pluralise( totals.assertions.passed, "assertion" ) << "."; " with " << pluralise( totals.assertions.passed, "assertion" ) << ".";
} }