| 12908 | } |
| 12909 | |
| 12910 | void RunContext::handleFatalErrorCondition( StringRef message ) { |
| 12911 | // First notify reporter that bad things happened |
| 12912 | m_reporter->fatalErrorEncountered(message); |
| 12913 | |
| 12914 | // Don't rebuild the result -- the stringification itself can cause more fatal errors |
| 12915 | // Instead, fake a result data. |
| 12916 | AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); |
| 12917 | tempResult.message = static_cast<std::string>(message); |
| 12918 | AssertionResult result(m_lastAssertionInfo, tempResult); |
| 12919 | |
| 12920 | assertionEnded(result); |
| 12921 | |
| 12922 | handleUnfinishedSections(); |
| 12923 | |
| 12924 | // Recreate section for test case (as we will lose the one that was in scope) |
| 12925 | auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); |
| 12926 | SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); |
| 12927 | |
| 12928 | Counts assertions; |
| 12929 | assertions.failed = 1; |
| 12930 | SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); |
| 12931 | m_reporter->sectionEnded(testCaseSectionStats); |
| 12932 | |
| 12933 | auto const& testInfo = m_activeTestCase->getTestCaseInfo(); |
| 12934 | |
| 12935 | Totals deltaTotals; |
| 12936 | deltaTotals.testCases.failed = 1; |
| 12937 | deltaTotals.assertions.failed = 1; |
| 12938 | m_reporter->testCaseEnded(TestCaseStats(testInfo, |
| 12939 | deltaTotals, |
| 12940 | std::string(), |
| 12941 | std::string(), |
| 12942 | false)); |
| 12943 | m_totals.testCases.failed++; |
| 12944 | testGroupEnded(std::string(), m_totals, 1, 1); |
| 12945 | m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); |
| 12946 | } |
| 12947 | |
| 12948 | bool RunContext::lastAssertionPassed() { |
| 12949 | return m_lastAssertionPassed; |
no test coverage detected