mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Tidied up reporting of missing assertions in test cases
- also removed basic reporter from approval test
This commit is contained in:
parent
801672b962
commit
b80280f428
@ -267,6 +267,7 @@ namespace Catch {
|
||||
TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
||||
SectionInfo testCaseSection( testCaseInfo.name, testCaseInfo.description, testCaseInfo.lineInfo );
|
||||
m_reporter->sectionStarting( testCaseSection );
|
||||
Counts prevAssertions = m_totals.assertions;
|
||||
try {
|
||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
||||
TestCaseTracker::Guard guard( *m_testCaseTracker );
|
||||
@ -297,7 +298,20 @@ namespace Catch {
|
||||
sectionEnded( it->info, it->prevAssertions );
|
||||
m_unfinishedSections.clear();
|
||||
m_messages.clear();
|
||||
SectionStats testCaseSectionStats( testCaseSection, Counts(), 0 ); // !TBD
|
||||
|
||||
Counts assertions = m_totals.assertions - prevAssertions;
|
||||
// !TBD?
|
||||
bool missingAssertions = false;
|
||||
if( assertions.total() == 0 &&
|
||||
m_config->warnAboutMissingAssertions() &&
|
||||
!m_testCaseTracker->currentSectionHasChildren() ) {
|
||||
m_totals.assertions.failed++;
|
||||
assertions.failed++;
|
||||
missingAssertions = true;
|
||||
|
||||
}
|
||||
|
||||
SectionStats testCaseSectionStats( testCaseSection, assertions, missingAssertions );
|
||||
m_reporter->sectionEnded( testCaseSectionStats );
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,11 @@ namespace Catch {
|
||||
if( _sectionStats.missingAssertions ) {
|
||||
lazyPrint();
|
||||
Colour colour( Colour::ResultError );
|
||||
stream << "\nNo assertions in section, '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
|
||||
if( currentSectionInfo->parent )
|
||||
stream << "\nNo assertions in section";
|
||||
else
|
||||
stream << "\nNo assertions in test case";
|
||||
stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
|
||||
}
|
||||
m_headerPrinted = false;
|
||||
StreamingReporterBase::sectionEnded( _sectionStats );
|
||||
@ -262,6 +266,7 @@ namespace Catch {
|
||||
}
|
||||
void printTestCaseAndSectionHeader() {
|
||||
printOpenHeader( unusedTestCaseInfo->name );
|
||||
assert( currentSectionInfo );
|
||||
if( currentSectionInfo ) {
|
||||
Colour colourGuard( Colour::Headers );
|
||||
std::vector<ThreadedSectionInfo*> sections;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -26,8 +26,6 @@ subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "console"
|
||||
subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "console", "-a", "4" ], stdout=f, stderr=f )
|
||||
subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "junit" ], stdout=f, stderr=f )
|
||||
subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "xml" ], stdout=f, stderr=f )
|
||||
subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "basic" ], stdout=f, stderr=f )
|
||||
subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "basic", "-a", "4" ], stdout=f, stderr=f )
|
||||
f.close()
|
||||
|
||||
rawFile = open( rawResultsPath, 'r' )
|
||||
|
Loading…
Reference in New Issue
Block a user