mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
INFOs only reset at assertion if consumed
This commit is contained in:
parent
239fa28e46
commit
0d357302a0
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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 )
|
||||
|
@ -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 (
|
||||
|
@ -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 ) {
|
||||
|
@ -397,7 +397,8 @@ MessageTests.cpp:37: FAILED:
|
||||
CHECK( a == 1 )
|
||||
with expansion:
|
||||
2 == 1
|
||||
with message:
|
||||
with messages:
|
||||
this message may be logged later
|
||||
this message should be logged
|
||||
|
||||
MessageTests.cpp:41: FAILED:
|
||||
@ -514,7 +515,8 @@ MiscTests.cpp:111: FAILED:
|
||||
CHECK( ( fib[i] % 2 ) == 0 )
|
||||
with expansion:
|
||||
1 == 0
|
||||
with message:
|
||||
with messages:
|
||||
Testing if fib[2] (2) is even
|
||||
Testing if fib[3] (3) is even
|
||||
|
||||
MiscTests.cpp:111: FAILED:
|
||||
@ -528,7 +530,8 @@ MiscTests.cpp:111: FAILED:
|
||||
CHECK( ( fib[i] % 2 ) == 0 )
|
||||
with expansion:
|
||||
1 == 0
|
||||
with message:
|
||||
with messages:
|
||||
Testing if fib[5] (8) is even
|
||||
Testing if fib[6] (13) is even
|
||||
|
||||
MiscTests.cpp:111: FAILED:
|
||||
@ -2786,7 +2789,7 @@ PASSED:
|
||||
with expansion:
|
||||
2 == 2
|
||||
with message:
|
||||
this message should not be logged
|
||||
this message may be logged later
|
||||
|
||||
MessageTests.cpp:37: FAILED:
|
||||
CHECK( a == 1 )
|
||||
|
@ -28,7 +28,7 @@ TEST_CASE( "./failing/message/info/1", "INFO gets logged on failure" )
|
||||
|
||||
TEST_CASE( "./mixed/message/info/2", "INFO gets logged on failure" )
|
||||
{
|
||||
INFO( "this message should not be logged" );
|
||||
INFO( "this message may be logged later" );
|
||||
int a = 2;
|
||||
CHECK( a == 2 );
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace Catch {
|
||||
virtual void testCaseStarting( TestCaseInfo const& ) {}
|
||||
virtual void sectionStarting( SectionInfo const& ) {}
|
||||
virtual void assertionStarting( AssertionInfo const& ) {}
|
||||
virtual void assertionEnded( AssertionStats const& ) {}
|
||||
virtual bool assertionEnded( AssertionStats const& ) { return false; }
|
||||
virtual void sectionEnded( SectionStats const& ) {}
|
||||
virtual void testCaseEnded( TestCaseStats const& ) {}
|
||||
virtual void testGroupEnded( TestGroupStats const& ) {}
|
||||
|
Loading…
Reference in New Issue
Block a user