mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Removed assertionRun() and rolled its logic into assertionPassed() and assertionEnded()
This commit is contained in:
parent
67f734c799
commit
57c346a46d
@ -38,16 +38,15 @@ namespace Catch {
|
|||||||
virtual void pushScopedMessage( MessageInfo const& message ) = 0;
|
virtual void pushScopedMessage( MessageInfo const& message ) = 0;
|
||||||
virtual void popScopedMessage( MessageInfo const& message ) = 0;
|
virtual void popScopedMessage( MessageInfo const& message ) = 0;
|
||||||
|
|
||||||
virtual std::string getCurrentTestName() const = 0;
|
|
||||||
virtual const AssertionResult* getLastResult() const = 0;
|
|
||||||
|
|
||||||
virtual void exceptionEarlyReported() = 0;
|
|
||||||
|
|
||||||
virtual void handleFatalErrorCondition( StringRef message ) = 0;
|
virtual void handleFatalErrorCondition( StringRef message ) = 0;
|
||||||
|
|
||||||
virtual bool lastAssertionPassed() = 0;
|
virtual bool lastAssertionPassed() = 0;
|
||||||
virtual void assertionPassed() = 0;
|
virtual void assertionPassed() = 0;
|
||||||
virtual void assertionRun() = 0;
|
|
||||||
|
// Deprecated, do not use:
|
||||||
|
virtual std::string getCurrentTestName() const = 0;
|
||||||
|
virtual const AssertionResult* getLastResult() const = 0;
|
||||||
|
virtual void exceptionEarlyReported() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
IResultCapture& getResultCapture();
|
IResultCapture& getResultCapture();
|
||||||
|
@ -111,6 +111,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::assertionEnded(AssertionResult const & result) {
|
void RunContext::assertionEnded(AssertionResult const & result) {
|
||||||
|
m_prevPassed = m_totals.assertions.passed;
|
||||||
if (result.getResultType() == ResultWas::Ok) {
|
if (result.getResultType() == ResultWas::Ok) {
|
||||||
m_totals.assertions.passed++;
|
m_totals.assertions.passed++;
|
||||||
} else if (!result.isOk()) {
|
} else if (!result.isOk()) {
|
||||||
@ -254,14 +255,11 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::assertionPassed() {
|
void RunContext::assertionPassed() {
|
||||||
|
m_prevPassed = m_totals.assertions.passed;
|
||||||
++m_totals.assertions.passed;
|
++m_totals.assertions.passed;
|
||||||
resetAssertionInfo();
|
resetAssertionInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::assertionRun() {
|
|
||||||
m_prevPassed = m_totals.assertions.passed;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RunContext::aborting() const {
|
bool RunContext::aborting() const {
|
||||||
return m_totals.assertions.failed == static_cast<std::size_t>(m_config->abortAfter());
|
return m_totals.assertions.failed == static_cast<std::size_t>(m_config->abortAfter());
|
||||||
}
|
}
|
||||||
@ -332,14 +330,12 @@ namespace Catch {
|
|||||||
AssertionReaction& reaction
|
AssertionReaction& reaction
|
||||||
) {
|
) {
|
||||||
m_reporter->assertionStarting( info );
|
m_reporter->assertionStarting( info );
|
||||||
assertionRun();
|
|
||||||
|
|
||||||
bool negated = isFalseTest( info.resultDisposition );
|
bool negated = isFalseTest( info.resultDisposition );
|
||||||
bool result = expr.getResult() != negated;
|
bool result = expr.getResult() != negated;
|
||||||
|
|
||||||
if( result ) {
|
if( result ) {
|
||||||
if (!m_includeSuccessfulResults) {
|
if (!m_includeSuccessfulResults) {
|
||||||
assertionRun();
|
|
||||||
assertionPassed();
|
assertionPassed();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -375,7 +371,6 @@ namespace Catch {
|
|||||||
m_reporter->assertionStarting( info );
|
m_reporter->assertionStarting( info );
|
||||||
|
|
||||||
m_lastAssertionInfo = info;
|
m_lastAssertionInfo = info;
|
||||||
assertionRun();
|
|
||||||
|
|
||||||
AssertionResultData data( resultType, LazyExpression( false ) );
|
AssertionResultData data( resultType, LazyExpression( false ) );
|
||||||
data.message = message;
|
data.message = message;
|
||||||
@ -397,7 +392,6 @@ namespace Catch {
|
|||||||
AssertionReaction& reaction
|
AssertionReaction& reaction
|
||||||
) {
|
) {
|
||||||
m_lastAssertionInfo = info;
|
m_lastAssertionInfo = info;
|
||||||
assertionRun();
|
|
||||||
|
|
||||||
AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
|
AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
|
||||||
data.message = message;
|
data.message = message;
|
||||||
@ -415,7 +409,6 @@ namespace Catch {
|
|||||||
AssertionInfo const& info
|
AssertionInfo const& info
|
||||||
) {
|
) {
|
||||||
m_lastAssertionInfo = info;
|
m_lastAssertionInfo = info;
|
||||||
assertionRun();
|
|
||||||
|
|
||||||
AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
|
AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
|
||||||
data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE";
|
data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE";
|
||||||
@ -428,7 +421,6 @@ namespace Catch {
|
|||||||
AssertionReaction &reaction
|
AssertionReaction &reaction
|
||||||
) {
|
) {
|
||||||
m_lastAssertionInfo = info;
|
m_lastAssertionInfo = info;
|
||||||
assertionRun();
|
|
||||||
|
|
||||||
AssertionResultData data( resultType, LazyExpression( false ) );
|
AssertionResultData data( resultType, LazyExpression( false ) );
|
||||||
AssertionResult assertionResult{ info, data };
|
AssertionResult assertionResult{ info, data };
|
||||||
|
@ -133,9 +133,7 @@ namespace Catch {
|
|||||||
|
|
||||||
bool lastAssertionPassed() override;
|
bool lastAssertionPassed() override;
|
||||||
|
|
||||||
void assertionPassed() override; // devirt
|
void assertionPassed() override;
|
||||||
|
|
||||||
void assertionRun() override; // devirt
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// !TBD We need to do this another way!
|
// !TBD We need to do this another way!
|
||||||
|
Loading…
Reference in New Issue
Block a user