MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / runCurrentTest

Method runCurrentTest

Bcore/src/main/cpp/Dobby/tests/catch.hpp:8735–8786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8733}
8734
8735void 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
8788void RunContext::invokeActiveTestCase() {
8789 FatalConditionHandler fatalConditionHandler; // Handle signals

Callers

nothing calls this directly

Calls 11

StringRefClass · 0.85
seedRngFunction · 0.85
translateActiveExceptionFunction · 0.85
getElapsedSecondsMethod · 0.80
sectionStartingMethod · 0.45
getPreferencesMethod · 0.45
startMethod · 0.45
strMethod · 0.45
closeMethod · 0.45
clearMethod · 0.45
sectionEndedMethod · 0.45

Tested by

no test coverage detected