mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	Removed now redundant handling for missing assertions in test cases
- handled as part of sections
This commit is contained in:
		@@ -134,13 +134,11 @@ namespace Catch
 | 
				
			|||||||
                        Totals const& _totals,
 | 
					                        Totals const& _totals,
 | 
				
			||||||
                        std::string const& _stdOut,
 | 
					                        std::string const& _stdOut,
 | 
				
			||||||
                        std::string const& _stdErr,
 | 
					                        std::string const& _stdErr,
 | 
				
			||||||
                        bool _missingAssertions,
 | 
					 | 
				
			||||||
                        bool _aborting )
 | 
					                        bool _aborting )
 | 
				
			||||||
        : testInfo( _testInfo ),
 | 
					        : testInfo( _testInfo ),
 | 
				
			||||||
            totals( _totals ),
 | 
					            totals( _totals ),
 | 
				
			||||||
            stdOut( _stdOut ),
 | 
					            stdOut( _stdOut ),
 | 
				
			||||||
            stdErr( _stdErr ),
 | 
					            stdErr( _stdErr ),
 | 
				
			||||||
            missingAssertions( _missingAssertions ),
 | 
					 | 
				
			||||||
            aborting( _aborting )
 | 
					            aborting( _aborting )
 | 
				
			||||||
        {}
 | 
					        {}
 | 
				
			||||||
        virtual ~TestCaseStats();
 | 
					        virtual ~TestCaseStats();
 | 
				
			||||||
@@ -149,7 +147,6 @@ namespace Catch
 | 
				
			|||||||
        Totals totals;
 | 
					        Totals totals;
 | 
				
			||||||
        std::string stdOut;
 | 
					        std::string stdOut;
 | 
				
			||||||
        std::string stdErr;
 | 
					        std::string stdErr;
 | 
				
			||||||
        bool missingAssertions;
 | 
					 | 
				
			||||||
        bool aborting;
 | 
					        bool aborting;
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,8 +63,6 @@ namespace Catch
 | 
				
			|||||||
        m_legacyReporter->EndSection( sectionStats.sectionInfo.name, sectionStats.assertions );
 | 
					        m_legacyReporter->EndSection( sectionStats.sectionInfo.name, sectionStats.assertions );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    void LegacyReporterAdapter::testCaseEnded( TestCaseStats const& testCaseStats ) {
 | 
					    void LegacyReporterAdapter::testCaseEnded( TestCaseStats const& testCaseStats ) {
 | 
				
			||||||
        if( testCaseStats.missingAssertions )
 | 
					 | 
				
			||||||
            m_legacyReporter->NoAssertionsInTestCase( testCaseStats.testInfo.name );
 | 
					 | 
				
			||||||
        m_legacyReporter->EndTestCase
 | 
					        m_legacyReporter->EndTestCase
 | 
				
			||||||
            (   testCaseStats.testInfo,
 | 
					            (   testCaseStats.testInfo,
 | 
				
			||||||
                testCaseStats.totals,
 | 
					                testCaseStats.totals,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,23 +126,13 @@ namespace Catch {
 | 
				
			|||||||
            while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
 | 
					            while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Totals deltaTotals = m_totals.delta( prevTotals );
 | 
					            Totals deltaTotals = m_totals.delta( prevTotals );
 | 
				
			||||||
            bool missingAssertions = false;
 | 
					 | 
				
			||||||
            if( deltaTotals.assertions.total() == 0  && m_config->warnAboutMissingAssertions() ) {
 | 
					 | 
				
			||||||
                m_totals.assertions.failed++;
 | 
					 | 
				
			||||||
                deltaTotals = m_totals.delta( prevTotals );
 | 
					 | 
				
			||||||
                missingAssertions = true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            m_totals.testCases += deltaTotals.testCases;
 | 
					            m_totals.testCases += deltaTotals.testCases;
 | 
				
			||||||
 | 
					 | 
				
			||||||
            m_reporter->testCaseEnded( TestCaseStats(   testInfo,
 | 
					            m_reporter->testCaseEnded( TestCaseStats(   testInfo,
 | 
				
			||||||
                                                        deltaTotals,
 | 
					                                                        deltaTotals,
 | 
				
			||||||
                                                        redirectedCout,
 | 
					                                                        redirectedCout,
 | 
				
			||||||
                                                        redirectedCerr,
 | 
					                                                        redirectedCerr,
 | 
				
			||||||
                                                        missingAssertions,
 | 
					 | 
				
			||||||
                                                        aborting() ) );
 | 
					                                                        aborting() ) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
            m_activeTestCase = NULL;
 | 
					            m_activeTestCase = NULL;
 | 
				
			||||||
            m_testCaseTracker.reset();
 | 
					            m_testCaseTracker.reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,12 +73,6 @@ namespace Catch {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) {
 | 
					        virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if( _testCaseStats.missingAssertions ) {
 | 
					 | 
				
			||||||
                lazyPrint();
 | 
					 | 
				
			||||||
                Colour colour( Colour::ResultError );
 | 
					 | 
				
			||||||
                stream << "\nNo assertions in test case, '" << _testCaseStats.testInfo.name << "'\n" << std::endl;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            StreamingReporterBase::testCaseEnded( _testCaseStats );
 | 
					            StreamingReporterBase::testCaseEnded( _testCaseStats );
 | 
				
			||||||
            m_headerPrinted = false;
 | 
					            m_headerPrinted = false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user