mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Just track whether last assertion passed directly, rather than deduce it from counts
This commit is contained in:
parent
57c346a46d
commit
dfa817ae73
@ -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();
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ namespace Catch {
|
||||
std::vector<SectionEndInfo> m_unfinishedSections;
|
||||
std::vector<ITracker*> m_activeSections;
|
||||
TrackerContext m_trackerContext;
|
||||
std::size_t m_prevPassed = 0;
|
||||
bool m_lastAssertionPassed = false;
|
||||
bool m_shouldReportUnexpected = true;
|
||||
bool m_includeSuccessfulResults;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user