diff options
| author | Phil Nash | 2017-08-10 16:18:05 +0100 |
|---|---|---|
| committer | Phil Nash | 2017-08-10 16:18:05 +0100 |
| commit | 97c06ca6fbd46b53431de487a92e5e9db302c7c5 (patch) | |
| tree | 6fd2598a24d6cf3da13345981a886c60862e058b /include/internal/catch_run_context.cpp | |
| parent | 3382312bd8300f6b11fc627632ed4e5b466650d2 (diff) | |
| parent | ee9b19efd3737afc93e14023cc0b4a9fd2a21b7c (diff) | |
| download | catch3-97c06ca6fbd46b53431de487a92e5e9db302c7c5.tar.gz | |
Merge branch 'reevaluate' into dev-modernize
Diffstat (limited to 'include/internal/catch_run_context.cpp')
| -rw-r--r-- | include/internal/catch_run_context.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp index d25b958a..d1dd4168 100644 --- a/include/internal/catch_run_context.cpp +++ b/include/internal/catch_run_context.cpp @@ -32,10 +32,12 @@ namespace Catch { } RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter) - : m_runInfo(_config->name()), + : m_runInfo(_config->name()), m_context(getCurrentMutableContext()), m_config(_config), - m_reporter(std::move(reporter)) { + m_reporter(std::move(reporter)), + m_lastAssertionInfo{ "", SourceLineInfo("",0), "", ResultDisposition::Normal } + { m_context.setRunner(this); m_context.setConfig(m_config); m_context.setResultCapture(this); @@ -118,7 +120,7 @@ namespace Catch { static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); // Reset working state - m_lastAssertionInfo = AssertionInfo("", m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}", m_lastAssertionInfo.resultDisposition); + m_lastAssertionInfo = { "", m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}", m_lastAssertionInfo.resultDisposition }; m_lastResult = result; } @@ -193,7 +195,7 @@ namespace Catch { } const AssertionResult * RunContext::getLastResult() const { - return &m_lastResult; + return &(*m_lastResult); } void RunContext::exceptionEarlyReported() { @@ -203,7 +205,7 @@ namespace Catch { void RunContext::handleFatalErrorCondition(std::string const & message) { // Don't rebuild the result -- the stringification itself can cause more fatal errors // Instead, fake a result data. - AssertionResultData tempResult; + AssertionResultData tempResult( ResultWas::Unknown, { false } ); tempResult.resultType = ResultWas::FatalErrorCondition; tempResult.message = message; AssertionResult result(m_lastAssertionInfo, tempResult); @@ -261,7 +263,7 @@ namespace Catch { double duration = 0; m_shouldReportUnexpected = true; try { - m_lastAssertionInfo = AssertionInfo("TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal); + m_lastAssertionInfo = { "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal }; seedRng(*m_config); @@ -281,7 +283,11 @@ namespace Catch { // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions // are reported without translation at the point of origin. if (m_shouldReportUnexpected) { - makeUnexpectedResultBuilder().useActiveException(); + AssertionHandler + ( m_lastAssertionInfo.macroName, + m_lastAssertionInfo.lineInfo, + m_lastAssertionInfo.capturedExpression, + m_lastAssertionInfo.resultDisposition ).useActiveException(); } } m_testCaseTracker->close(); @@ -307,13 +313,6 @@ namespace Catch { fatalConditionHandler.reset(); } - ResultBuilder RunContext::makeUnexpectedResultBuilder() const { - return ResultBuilder(m_lastAssertionInfo.macroName, - m_lastAssertionInfo.lineInfo, - m_lastAssertionInfo.capturedExpression, - m_lastAssertionInfo.resultDisposition); - } - void RunContext::handleUnfinishedSections() { // If sections ended prematurely due to an exception we stored their // infos here so we can tear them down outside the unwind process. |