mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Completed NoAssertions warning implementation
This commit is contained in:
@@ -127,12 +127,19 @@ namespace Catch {
|
||||
virtual void StartSection( const std::string& sectionName, const std::string& ) {
|
||||
m_sectionSpans.push_back( SpanInfo( sectionName ) );
|
||||
}
|
||||
|
||||
|
||||
virtual void NoAssertionsInSection( const std::string& sectionName ) {
|
||||
StartSpansLazily();
|
||||
TextColour colour( TextColour::ResultError );
|
||||
m_config.stream << "\nNo assertions in section, '" << sectionName << "'\n" << std::endl;
|
||||
}
|
||||
virtual void NoAssertionsInTestCase( const std::string& testName ) {
|
||||
StartSpansLazily();
|
||||
TextColour colour( TextColour::ResultError );
|
||||
m_config.stream << "\nNo assertions in test case, '" << testName << "'\n" << std::endl;
|
||||
}
|
||||
|
||||
virtual void EndSection( const std::string& sectionName, const Counts& assertions ) {
|
||||
if( ( m_config.fullConfig.warnings & ConfigData::WarnAbout::NoAssertions ) && assertions.total() == 0 ) {
|
||||
StartSpansLazily();
|
||||
m_config.stream << "** No assertions in section **" << std::endl;
|
||||
}
|
||||
|
||||
SpanInfo& sectionSpan = m_sectionSpans.back();
|
||||
if( sectionSpan.emitted && !sectionSpan.name.empty() ) {
|
||||
|
@@ -88,7 +88,10 @@ namespace Catch {
|
||||
|
||||
virtual void StartSection( const std::string&, const std::string& ){}
|
||||
|
||||
virtual void EndSection( const std::string&, const Counts& ){}
|
||||
virtual void NoAssertionsInSection( const std::string& ) {}
|
||||
virtual void NoAssertionsInTestCase( const std::string& ) {}
|
||||
|
||||
virtual void EndSection( const std::string&, const Counts& ) {}
|
||||
|
||||
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) {
|
||||
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getName() ) );
|
||||
|
@@ -60,6 +60,8 @@ namespace Catch {
|
||||
.writeAttribute( "name", sectionName )
|
||||
.writeAttribute( "description", description );
|
||||
}
|
||||
virtual void NoAssertionsInSection( const std::string& ) {}
|
||||
virtual void NoAssertionsInTestCase( const std::string& ) {}
|
||||
|
||||
virtual void EndSection( const std::string& /*sectionName*/, const Counts& assertions ) {
|
||||
m_xml.scopedElement( "OverallResults" )
|
||||
|
Reference in New Issue
Block a user