Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorPhil Nash2013-06-28 16:25:49 +0100
committerPhil Nash2013-06-28 16:25:49 +0100
commit0d357302a01b66ae7cd55ff44266ebddd57328de (patch)
treeef0a0f31bf0464781bcc3f7c43d3585b9df50fc4 /include
parent239fa28e4679b2889b715f98243d2af380beadaf (diff)
downloadcatch3-0d357302a01b66ae7cd55ff44266ebddd57328de.tar.gz
INFOs only reset at assertion if consumed
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_interfaces_reporter.h2
-rw-r--r--include/internal/catch_legacy_reporter_adapter.h2
-rw-r--r--include/internal/catch_legacy_reporter_adapter.hpp3
-rw-r--r--include/internal/catch_runner_impl.hpp4
-rw-r--r--include/reporters/catch_reporter_console.hpp5
5 files changed, 9 insertions, 7 deletions
diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h
index 6419afc0..654abf32 100644
--- a/include/internal/catch_interfaces_reporter.h
+++ b/include/internal/catch_interfaces_reporter.h
@@ -208,7 +208,7 @@ namespace Catch
virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
- virtual void assertionEnded( AssertionStats const& assertionStats ) = 0;
+ virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0;
virtual void sectionEnded( SectionStats const& sectionStats ) = 0;
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0;
diff --git a/include/internal/catch_legacy_reporter_adapter.h b/include/internal/catch_legacy_reporter_adapter.h
index 08bf6854..32d03f15 100644
--- a/include/internal/catch_legacy_reporter_adapter.h
+++ b/include/internal/catch_legacy_reporter_adapter.h
@@ -25,7 +25,7 @@ namespace Catch
virtual void testCaseStarting( TestCaseInfo const& testInfo );
virtual void sectionStarting( SectionInfo const& sectionInfo );
virtual void assertionStarting( AssertionInfo const& );
- virtual void assertionEnded( AssertionStats const& assertionStats );
+ virtual bool assertionEnded( AssertionStats const& assertionStats );
virtual void sectionEnded( SectionStats const& sectionStats );
virtual void testCaseEnded( TestCaseStats const& testCaseStats );
virtual void testGroupEnded( TestGroupStats const& testGroupStats );
diff --git a/include/internal/catch_legacy_reporter_adapter.hpp b/include/internal/catch_legacy_reporter_adapter.hpp
index 27ffc1e1..412363d4 100644
--- a/include/internal/catch_legacy_reporter_adapter.hpp
+++ b/include/internal/catch_legacy_reporter_adapter.hpp
@@ -40,7 +40,7 @@ namespace Catch
// Not on legacy interface
}
- void LegacyReporterAdapter::assertionEnded( AssertionStats const& assertionStats ) {
+ bool LegacyReporterAdapter::assertionEnded( AssertionStats const& assertionStats ) {
if( assertionStats.assertionResult.getResultType() != ResultWas::Ok ) {
for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end();
it != itEnd;
@@ -55,6 +55,7 @@ namespace Catch
}
}
m_legacyReporter->Result( assertionStats.assertionResult );
+ return true;
}
void LegacyReporterAdapter::sectionEnded( SectionStats const& sectionStats ) {
if( sectionStats.missingAssertions )
diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp
index 7058d827..5191d7fa 100644
--- a/include/internal/catch_runner_impl.hpp
+++ b/include/internal/catch_runner_impl.hpp
@@ -171,11 +171,11 @@ namespace Catch {
m_totals.assertions.failed++;
}
- m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) );
+ if( m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) ) )
+ m_messages.clear();
// Reset working state
m_lastAssertionInfo = AssertionInfo( "", m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition );
- m_messages.clear();
}
virtual bool sectionStarted (
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index cd5cd7be..ceccce94 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -39,18 +39,19 @@ namespace Catch {
virtual void assertionStarting( AssertionInfo const& ) {
}
- virtual void assertionEnded( AssertionStats const& _assertionStats ) {
+ virtual bool assertionEnded( AssertionStats const& _assertionStats ) {
AssertionResult const& result = _assertionStats.assertionResult;
// Drop out if result was successful and we're not printing those
if( !m_config->includeSuccessfulResults() && result.isOk() )
- return;
+ return false;
lazyPrint();
AssertionPrinter printer( stream, _assertionStats );
printer.print();
stream << std::endl;
+ return true;
}
virtual void sectionStarting( SectionInfo const& _sectionInfo ) {