Cleaned up summary reporting

Improved newlines and pluralisation
This commit is contained in:
Phil Nash 2012-02-22 09:42:34 +00:00
parent 3619cb2f09
commit e1a2480f49
2 changed files with 25 additions and 6 deletions

View File

@ -70,11 +70,30 @@ namespace Catch
if( failed + succeeded == 0 ) if( failed + succeeded == 0 )
m_config.stream() << "No tests ran"; m_config.stream() << "No tests ran";
else if( failed == 0 ) else if( failed == 0 )
m_config.stream() << "All " << succeeded << " test(s) succeeded"; {
else if( succeeded == 0 ) if( succeeded == 1 )
m_config.stream() << "All " << failed << " test(s) failed"; m_config.stream() << "1 test succeeded";
else else
m_config.stream() << succeeded << " test(s) passed but " << failed << " test(s) failed"; m_config.stream() << "All " << succeeded << " tests succeeded";
}
else if( succeeded == 0 )
{
if( failed == 1 )
m_config.stream() << "1 test failed";
else
m_config.stream() << "All " << failed << " tests failed";
}
else
{
m_config.stream() << succeeded << " test";
if( succeeded > 1 )
m_config.stream() << "s";
m_config.stream() << " passed but " << failed << " test";
if( failed > 1 )
m_config.stream() << "s";
m_config.stream() << " failed";
}
} }
private: // IReporter private: // IReporter
@ -102,7 +121,7 @@ namespace Catch
) )
{ {
// Output the overall test results even if "Started Testing" was not emitted // Output the overall test results even if "Started Testing" was not emitted
m_config.stream() << "[Testing completed. "; m_config.stream() << "\n[Testing completed. ";
ReportCounts( succeeded, failed ); ReportCounts( succeeded, failed );
m_config.stream() << "]\n" << std::endl; m_config.stream() << "]\n" << std::endl;
} }

View File

@ -98,9 +98,9 @@ TEST_CASE( "./mixed/Misc/loops", "looped tests" )
TEST_CASE( "./succeeding/Misc/stdout,stderr", "Sends stuff to stdout and stderr" ) TEST_CASE( "./succeeding/Misc/stdout,stderr", "Sends stuff to stdout and stderr" )
{ {
std::cout << "Some information"; std::cout << "Some information" << std::endl;
std::cerr << "An error"; std::cerr << "An error" << std::endl;
} }
inline const char* makeString( bool makeNull ) inline const char* makeString( bool makeNull )