INFOs only reset at assertion if consumed

This commit is contained in:
Phil Nash
2013-06-28 16:25:49 +01:00
parent 239fa28e46
commit 0d357302a0
8 changed files with 18 additions and 13 deletions

View File

@@ -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;

View File

@@ -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 );

View File

@@ -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 )

View File

@@ -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 (

View File

@@ -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 ) {