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