Function handleFatalErrorCondition

Synopsis

#include <include/internal/catch_run_context.h>

void handleFatalErrorCondition(StringRef message) override

Description

No description yet.

Source

Lines 310-346 in include/internal/catch_run_context.cpp. Line 103 in include/internal/catch_run_context.h.

void RunContext::handleFatalErrorCondition( StringRef message ) {
    // First notify reporter that bad things happened
    m_reporter->fatalErrorEncountered(message);
    // Don't rebuild the result -- the stringification itself can cause more fatal errors
    // Instead, fake a result data.
    AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );
    tempResult.message = static_cast<std::string>(message);
    AssertionResult result(m_lastAssertionInfo, tempResult);
    assertionEnded(result);
    handleUnfinishedSections();
    // Recreate section for test case (as we will lose the one that was in scope)
    auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
    SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
    Counts assertions;
    assertions.failed = 1;
    SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);
    m_reporter->sectionEnded(testCaseSectionStats);
    auto const& 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));
}





Add Discussion as Guest

Log in