mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 03:43:28 +01:00
More tweaks to summary format
This commit is contained in:
parent
52e1e7414a
commit
94a1acf766
@ -20,8 +20,7 @@ namespace Catch {
|
||||
struct ConsoleReporter : StreamingReporterBase {
|
||||
ConsoleReporter( ReporterConfig const& _config )
|
||||
: StreamingReporterBase( _config ),
|
||||
m_headerPrinted( false ),
|
||||
m_atLeastOneTestCasePrinted( false )
|
||||
m_headerPrinted( false )
|
||||
{}
|
||||
|
||||
virtual ~ConsoleReporter();
|
||||
@ -103,9 +102,6 @@ namespace Catch {
|
||||
virtual void testRunEnded( TestRunStats const& _testRunStats ) {
|
||||
printTotalsDivider( _testRunStats.totals );
|
||||
printTotals( _testRunStats.totals );
|
||||
if( m_atLeastOneTestCasePrinted ||
|
||||
( _testRunStats.totals.assertions.total() == 0 && _testRunStats.totals.testCases.total() > 0 ) )
|
||||
printTotalsDivider( _testRunStats.totals );
|
||||
stream << std::endl;
|
||||
StreamingReporterBase::testRunEnded( _testRunStats );
|
||||
}
|
||||
@ -257,7 +253,6 @@ namespace Catch {
|
||||
printTestCaseAndSectionHeader();
|
||||
m_headerPrinted = true;
|
||||
}
|
||||
m_atLeastOneTestCasePrinted = true;
|
||||
}
|
||||
void lazyPrintRunInfo() {
|
||||
stream << "\n" << getLineOfChars<'~'>() << "\n";
|
||||
@ -334,13 +329,16 @@ namespace Catch {
|
||||
stream << Colour( Colour::Warning ) << "No tests ran\n";
|
||||
}
|
||||
else if( totals.assertions.total() == 0 ) {
|
||||
printCounts( "test case", totals.testCases, cols );
|
||||
stream << "test cases: ";
|
||||
printCounts( totals.testCases, cols );
|
||||
stream << "assertions: ";
|
||||
stream << Colour( Colour::Warning ) << "- none -\n";
|
||||
}
|
||||
else if( totals.assertions.failed + totals.assertions.failedButOk ) {
|
||||
printCounts( "test case", totals.testCases, cols );
|
||||
printCounts( "assertion", totals.assertions, cols );
|
||||
stream << "test cases: ";
|
||||
printCounts( totals.testCases, cols );
|
||||
stream << "assertions: ";
|
||||
printCounts( totals.assertions, cols );
|
||||
}
|
||||
else {
|
||||
stream << Colour( Colour::ResultSuccess ) << "All tests passed";
|
||||
@ -350,10 +348,8 @@ namespace Catch {
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
void printCounts( std::string const& label, Counts const& counts, int cols ) {
|
||||
stream << label << "s: ";
|
||||
|
||||
stream << Colour( counts.passed > 0 ? Colour::ResultSuccess : Colour::LightGrey )
|
||||
void printCounts( Counts const& counts, int cols ) {
|
||||
stream << Colour( counts.passed > 0 ? Colour::Success : Colour::LightGrey )
|
||||
<< std::setw( cols ) << counts.passed << " passed";
|
||||
|
||||
stream << Colour( Colour::LightGrey ) << " | ";
|
||||
@ -365,8 +361,8 @@ namespace Catch {
|
||||
stream << Colour( counts.failedButOk > 0 ? Colour::ResultExpectedFailure : Colour::LightGrey )
|
||||
<< std::setw( cols ) << counts.failedButOk << " failed as expected";
|
||||
}
|
||||
stream << Colour( Colour::LightGrey ) << " | ";
|
||||
stream << "total: " << counts.total() << "\n";
|
||||
stream << Colour( Colour::LightGrey ) << " | "
|
||||
<< "total: " << counts.total() << "\n";
|
||||
}
|
||||
|
||||
static std::size_t makeRatio( std::size_t number, std::size_t total ) {
|
||||
@ -416,7 +412,6 @@ namespace Catch {
|
||||
|
||||
private:
|
||||
bool m_headerPrinted;
|
||||
bool m_atLeastOneTestCasePrinted;
|
||||
};
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
|
||||
|
Loading…
Reference in New Issue
Block a user