diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp index 0e9cf983..44e3fb37 100644 --- a/include/internal/catch_run_context.cpp +++ b/include/internal/catch_run_context.cpp @@ -111,15 +111,19 @@ namespace Catch { } void RunContext::assertionEnded(AssertionResult const & result) { - m_prevPassed = m_totals.assertions.passed; if (result.getResultType() == ResultWas::Ok) { m_totals.assertions.passed++; + m_lastAssertionPassed = true; } else if (!result.isOk()) { + m_lastAssertionPassed = false; if( m_activeTestCase->getTestCaseInfo().okToFail() ) m_totals.assertions.failedButOk++; else m_totals.assertions.failed++; } + else { + m_lastAssertionPassed = true; + } // We have no use for the return value (whether messages should be cleared), because messages were made scoped // and should be let to clear themselves out. @@ -251,11 +255,11 @@ namespace Catch { } bool RunContext::lastAssertionPassed() { - return m_totals.assertions.passed == (m_prevPassed + 1); + return m_lastAssertionPassed; } void RunContext::assertionPassed() { - m_prevPassed = m_totals.assertions.passed; + m_lastAssertionPassed = true; ++m_totals.assertions.passed; resetAssertionInfo(); } diff --git a/include/internal/catch_run_context.h b/include/internal/catch_run_context.h index 617baba1..88767711 100644 --- a/include/internal/catch_run_context.h +++ b/include/internal/catch_run_context.h @@ -164,7 +164,7 @@ namespace Catch { std::vector m_unfinishedSections; std::vector m_activeSections; TrackerContext m_trackerContext; - std::size_t m_prevPassed = 0; + bool m_lastAssertionPassed = false; bool m_shouldReportUnexpected = true; bool m_includeSuccessfulResults; };