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

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-07-16 19:23:51 +0200
committerMartin Hořeňovský2025-07-16 21:29:53 +0200
commit1b72e45354cdbb3be45fb438f930ecf3d5604e20 (patch)
treed25d712cf443e12f4df5579e318a871ddd3bb538 /src
parentf7968e96975ed30231d5f5614a159e1baa7ba664 (diff)
downloadcatch3-1b72e45354cdbb3be45fb438f930ecf3d5604e20.tar.gz
Cache config::abortAfter and config::shouldDebugBreak in RunContext
Diffstat (limited to 'src')
-rw-r--r--src/catch2/internal/catch_run_context.cpp8
-rw-r--r--src/catch2/internal/catch_run_context.hpp2
2 files changed, 7 insertions, 3 deletions
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 90d3e66d..a8fe248f 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -171,7 +171,9 @@ namespace Catch {
m_reporter(CATCH_MOVE(reporter)),
m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal },
m_outputRedirect( makeOutputRedirect( m_reporter->getPreferences().shouldRedirectStdOut ) ),
- m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions )
+ m_abortAfterXFailedAssertions( m_config->abortAfter() ),
+ m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ),
+ m_shouldDebugBreak( m_config->shouldDebugBreak() )
{
getCurrentMutableContext().setResultCapture( this );
m_reporter->testRunStarting(m_runInfo);
@@ -523,7 +525,7 @@ namespace Catch {
}
bool RunContext::aborting() const {
- return m_totals.assertions.failed >= static_cast<std::size_t>(m_config->abortAfter());
+ return m_totals.assertions.failed >= m_abortAfterXFailedAssertions;
}
void RunContext::runCurrentTest() {
@@ -676,7 +678,7 @@ namespace Catch {
}
void RunContext::populateReaction( AssertionReaction& reaction ) {
- reaction.shouldDebugBreak = m_config->shouldDebugBreak();
+ reaction.shouldDebugBreak = m_shouldDebugBreak;
reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal);
}
diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp
index 66735f41..bf4c3768 100644
--- a/src/catch2/internal/catch_run_context.hpp
+++ b/src/catch2/internal/catch_run_context.hpp
@@ -151,9 +151,11 @@ namespace Catch {
TrackerContext m_trackerContext;
Detail::unique_ptr<OutputRedirect> m_outputRedirect;
FatalConditionHandler m_fatalConditionhandler;
+ size_t m_abortAfterXFailedAssertions;
bool m_lastAssertionPassed = false;
bool m_shouldReportUnexpected = true;
bool m_includeSuccessfulResults;
+ bool m_shouldDebugBreak;
};
void seedRng(IConfig const& config);