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 {
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
if( !m_config->includeSuccessfulResults() && result.isOk() ) {
if( result.getResultType() != ResultWas::Warning )
return false;
printInfoMessages = false;
}
// Drop out if result was successful but we're not printing them.
if( !includeResults && result.getResultType() != ResultWas::Warning )
return false;
lazyPrint();
AssertionPrinter printer( stream, _assertionStats, printInfoMessages );
AssertionPrinter printer( stream, _assertionStats, includeResults );
printer.print();
stream << std::endl;
return true;

View File

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