| 8733 | } |
| 8734 | |
| 8735 | void RunContext::runCurrentTest(std::string &redirectedCout, std::string &redirectedCerr) { |
| 8736 | auto const &testCaseInfo = m_activeTestCase->getTestCaseInfo(); |
| 8737 | SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description); |
| 8738 | m_reporter->sectionStarting(testCaseSection); |
| 8739 | Counts prevAssertions = m_totals.assertions; |
| 8740 | double duration = 0; |
| 8741 | m_shouldReportUnexpected = true; |
| 8742 | m_lastAssertionInfo = {"TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal}; |
| 8743 | |
| 8744 | seedRng(*m_config); |
| 8745 | |
| 8746 | Timer timer; |
| 8747 | try { |
| 8748 | if (m_reporter->getPreferences().shouldRedirectStdOut) { |
| 8749 | #if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) |
| 8750 | RedirectedStdOut redirectedStdOut; |
| 8751 | RedirectedStdErr redirectedStdErr; |
| 8752 | |
| 8753 | timer.start(); |
| 8754 | invokeActiveTestCase(); |
| 8755 | redirectedCout += redirectedStdOut.str(); |
| 8756 | redirectedCerr += redirectedStdErr.str(); |
| 8757 | #else |
| 8758 | OutputRedirect r(redirectedCout, redirectedCerr); |
| 8759 | timer.start(); |
| 8760 | invokeActiveTestCase(); |
| 8761 | #endif |
| 8762 | } else { |
| 8763 | timer.start(); |
| 8764 | invokeActiveTestCase(); |
| 8765 | } |
| 8766 | duration = timer.getElapsedSeconds(); |
| 8767 | } catch (TestFailureException &) { |
| 8768 | // This just means the test was aborted due to failure |
| 8769 | } catch (...) { |
| 8770 | // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions |
| 8771 | // are reported without translation at the point of origin. |
| 8772 | if (m_shouldReportUnexpected) { |
| 8773 | AssertionReaction dummyReaction; |
| 8774 | handleUnexpectedInflightException(m_lastAssertionInfo, translateActiveException(), dummyReaction); |
| 8775 | } |
| 8776 | } |
| 8777 | Counts assertions = m_totals.assertions - prevAssertions; |
| 8778 | bool missingAssertions = testForMissingAssertions(assertions); |
| 8779 | |
| 8780 | m_testCaseTracker->close(); |
| 8781 | handleUnfinishedSections(); |
| 8782 | m_messages.clear(); |
| 8783 | |
| 8784 | SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); |
| 8785 | m_reporter->sectionEnded(testCaseSectionStats); |
| 8786 | } |
| 8787 | |
| 8788 | void RunContext::invokeActiveTestCase() { |
| 8789 | FatalConditionHandler fatalConditionHandler; // Handle signals |
nothing calls this directly
no test coverage detected