Refactored console reporter include logic to match Xml Reporter’s

This commit is contained in:
Phil Nash 2017-03-03 14:19:41 +00:00
parent 9bee606dd6
commit f9db24a824
2 changed files with 6 additions and 9 deletions

View File

@ -40,18 +40,15 @@ namespace Catch {
virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE {
AssertionResult const& result = _assertionStats.assertionResult; AssertionResult const& result = _assertionStats.assertionResult;
bool printInfoMessages = true; bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
// Drop out if result was successful and we're not printing those // Drop out if result was successful but we're not printing them.
if( !m_config->includeSuccessfulResults() && result.isOk() ) { if( !includeResults && result.getResultType() != ResultWas::Warning )
if( result.getResultType() != ResultWas::Warning ) return false;
return false;
printInfoMessages = false;
}
lazyPrint(); lazyPrint();
AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); AssertionPrinter printer( stream, _assertionStats, includeResults );
printer.print(); printer.print();
stream << std::endl; stream << std::endl;
return true; return true;

View File

@ -95,7 +95,7 @@ namespace Catch {
AssertionResult const& result = assertionStats.assertionResult; AssertionResult const& result = assertionStats.assertionResult;
bool includeResults = m_config->includeSuccessfulResults() || result.isOk(); bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
if( includeResults ) { if( includeResults ) {
// Print any info messages in <Info> tags. // Print any info messages in <Info> tags.