MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / handleFatalErrorCondition

Method handleFatalErrorCondition

unittests/catch.hpp:8731–8767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8729 }
8730
8731 void RunContext::handleFatalErrorCondition( StringRef message ) {
8732 // First notify reporter that bad things happened
8733 m_reporter->fatalErrorEncountered(message);
8734
8735 // Don't rebuild the result -- the stringification itself can cause more fatal errors
8736 // Instead, fake a result data.
8737 AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );
8738 tempResult.message = message;
8739 AssertionResult result(m_lastAssertionInfo, tempResult);
8740
8741 assertionEnded(result);
8742
8743 handleUnfinishedSections();
8744
8745 // Recreate section for test case (as we will lose the one that was in scope)
8746 auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
8747 SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
8748
8749 Counts assertions;
8750 assertions.failed = 1;
8751 SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);
8752 m_reporter->sectionEnded(testCaseSectionStats);
8753
8754 auto const& testInfo = m_activeTestCase->getTestCaseInfo();
8755
8756 Totals deltaTotals;
8757 deltaTotals.testCases.failed = 1;
8758 deltaTotals.assertions.failed = 1;
8759 m_reporter->testCaseEnded(TestCaseStats(testInfo,
8760 deltaTotals,
8761 std::string(),
8762 std::string(),
8763 false));
8764 m_totals.testCases.failed++;
8765 testGroupEnded(std::string(), m_totals, 1, 1);
8766 m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));
8767 }
8768
8769 bool RunContext::lastAssertionPassed() {
8770 return m_lastAssertionPassed;

Callers 1

reportFatalFunction · 0.80

Calls 7

TestCaseStatsClass · 0.85
stringClass · 0.85
TestRunStatsClass · 0.85
fatalErrorEncounteredMethod · 0.80
sectionEndedMethod · 0.45
testCaseEndedMethod · 0.45
testRunEndedMethod · 0.45

Tested by

no test coverage detected