コード例 #1
0
 Section::~Section() {
     if( m_sectionIncluded ) {
         SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );
         if( uncaught_exceptions() )
             getResultCapture().sectionEndedEarly( endInfo );
         else
             getResultCapture().sectionEnded( endInfo );
     }
 }
コード例 #2
0
        virtual void handleFatalErrorCondition( std::string const& message ) {
            // Don't rebuild the result -- the stringification itself can cause more fatal errors
            // Instead, fake a result data.
            AssertionResultData tempResult;
            tempResult.resultType = ResultWas::FatalErrorCondition;
            tempResult.message = message;
            AssertionResult result(m_lastAssertionInfo, tempResult);

            getResultCapture().assertionEnded(result);

            handleUnfinishedSections();

            // Recreate section for test case (as we will lose the one that was in scope)
            TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
            SectionInfo testCaseSection( testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description );

            Counts assertions;
            assertions.failed = 1;
            SectionStats testCaseSectionStats( testCaseSection, assertions, 0, false );
            m_reporter->sectionEnded( testCaseSectionStats );

            TestCaseInfo testInfo = m_activeTestCase->getTestCaseInfo();

            Totals deltaTotals;
            deltaTotals.testCases.failed = 1;
            deltaTotals.assertions.failed = 1;
            m_reporter->testCaseEnded( TestCaseStats(   testInfo,
                                                        deltaTotals,
                                                        std::string(),
                                                        std::string(),
                                                        false ) );
            m_totals.testCases.failed++;
            testGroupEnded( std::string(), m_totals, 1, 1 );
            m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, false ) );
        }
コード例 #3
0
ファイル: catch_context_impl.hpp プロジェクト: ibond/Catch
 GeneratorsForTest& Context::getGeneratorsForCurrentTest() {
     GeneratorsForTest* generators = findGeneratorsForCurrentTest();
     if( !generators ) {
         std::string testName = getResultCapture().getCurrentTestName();
         generators = new GeneratorsForTest();
         m_generatorsByTestName.insert( std::make_pair( testName, generators ) );
     }
     return *generators;
 }
コード例 #4
0
ファイル: catch_context_impl.hpp プロジェクト: ibond/Catch
 GeneratorsForTest* Context::findGeneratorsForCurrentTest() {
     std::string testName = getResultCapture().getCurrentTestName();
     
     std::map<std::string, GeneratorsForTest*>::const_iterator it = 
         m_generatorsByTestName.find( testName );
     return it != m_generatorsByTestName.end()
         ? it->second
         : NULL;
 }
コード例 #5
0
 void ResultBuilder::handleResult( AssertionResult const& result )
 {
     getResultCapture().assertionEnded( result );
     
     if( !result.isOk() ) {
         if( getCurrentContext().getConfig()->shouldDebugBreak() )
             m_shouldDebugBreak = true;
         if( getCurrentContext().getRunner()->aborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) )
             m_shouldThrow = true;
     }
 }
コード例 #6
0
    void ResultBuilder::captureExpression() {
        AssertionResult result = build();
        getResultCapture().assertionEnded( result );

        if( !result.isOk() ) {
            if( getCurrentContext().getConfig()->shouldDebugBreak() )
                m_shouldDebugBreak = true;
            if( getCurrentContext().getRunner()->aborting() || m_assertionInfo.resultDisposition == ResultDisposition::Normal )
                m_shouldThrow = true;
        }
    }
コード例 #7
0
 Section::Section( SectionInfo const& info )
 :   m_info( info ),
     m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
 {
     m_timer.start();
 }
コード例 #8
0
ファイル: catch_capture.hpp プロジェクト: KazanCn/Catch
 ~ScopedInfo() {
     getResultCapture().popScopedInfo( this );
 }
コード例 #9
0
ファイル: catch_capture.hpp プロジェクト: KazanCn/Catch
 ScopedInfo() : m_resultBuilder( ResultWas::Info ) {
     getResultCapture().pushScopedInfo( this );
 }
コード例 #10
0
ファイル: catch_message.hpp プロジェクト: Philpo/Dissertation
 INTERNAL_CATCH_INLINE ScopedMessage::~ScopedMessage() {
     getResultCapture().popScopedMessage( m_info );
 }
コード例 #11
0
ファイル: catch_message.hpp プロジェクト: Philpo/Dissertation
 INTERNAL_CATCH_INLINE ScopedMessage::ScopedMessage( MessageBuilder const& builder )
 : m_info( builder.m_info )
 {
     m_info.message = builder.m_stream.str();
     getResultCapture().pushScopedMessage( m_info );
 }