Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-07-16 16:28:43 +0200
committerMartin Hořeňovský2025-07-16 21:43:00 +0200
commit066f00acf52f38fec7fc411b0b110b28f28a19fe (patch)
treea605e344fc7720be963fe44ecf9c5427d67f0629
parent1b72e45354cdbb3be45fb438f930ecf3d5604e20 (diff)
downloadcatch3-066f00acf52f38fec7fc411b0b110b28f28a19fe.tar.gz
Pass result disposition into RunContext::populateReaction directly
This avoids implicit dataflow through RunContext::m_lastAssertionInfo, which will be useful in later refactoring.
-rw-r--r--src/catch2/internal/catch_run_context.cpp19
-rw-r--r--src/catch2/internal/catch_run_context.hpp2
2 files changed, 14 insertions, 7 deletions
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index a8fe248f..4a0be7e3 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -612,7 +612,8 @@ namespace Catch {
}
else {
reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );
- populateReaction( reaction );
+ populateReaction(
+ reaction, info.resultDisposition & ResultDisposition::Normal );
}
resetAssertionInfo();
}
@@ -647,7 +648,8 @@ namespace Catch {
const auto isOk = assertionResult.isOk();
assertionEnded( CATCH_MOVE(assertionResult) );
if ( !isOk ) {
- populateReaction( reaction );
+ populateReaction(
+ reaction, info.resultDisposition & ResultDisposition::Normal );
} else if ( resultType == ResultWas::ExplicitSkip ) {
// TODO: Need to handle this explicitly, as ExplicitSkip is
// considered "OK"
@@ -673,13 +675,15 @@ namespace Catch {
data.message = CATCH_MOVE(message);
AssertionResult assertionResult{ info, CATCH_MOVE(data) };
assertionEnded( CATCH_MOVE(assertionResult) );
- populateReaction( reaction );
+ populateReaction( reaction,
+ info.resultDisposition & ResultDisposition::Normal );
resetAssertionInfo();
}
- void RunContext::populateReaction( AssertionReaction& reaction ) {
+ void RunContext::populateReaction( AssertionReaction& reaction,
+ bool has_normal_disposition ) {
reaction.shouldDebugBreak = m_shouldDebugBreak;
- reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal);
+ reaction.shouldThrow = aborting() || has_normal_disposition;
}
void RunContext::handleIncomplete(
@@ -706,7 +710,10 @@ namespace Catch {
const auto isOk = assertionResult.isOk();
assertionEnded( CATCH_MOVE(assertionResult) );
- if ( !isOk ) { populateReaction( reaction ); }
+ if ( !isOk ) {
+ populateReaction(
+ reaction, info.resultDisposition & ResultDisposition::Normal );
+ }
resetAssertionInfo();
}
diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp
index bf4c3768..4aecd662 100644
--- a/src/catch2/internal/catch_run_context.hpp
+++ b/src/catch2/internal/catch_run_context.hpp
@@ -129,7 +129,7 @@ namespace Catch {
ITransientExpression const *expr,
bool negated );
- void populateReaction( AssertionReaction& reaction );
+ void populateReaction( AssertionReaction& reaction, bool has_normal_disposition );
private: