diff options
| author | Martin Hořeňovský | 2026-04-07 13:35:57 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-04-07 14:33:39 +0200 |
| commit | 77eae8bd2a2c8c3135d30649aa7c51b5bfc0e61e (patch) | |
| tree | 6500b4818d9203f795e825c9ee7d839f9e4ce7d9 /src/catch2/internal/catch_run_context.cpp | |
| parent | 3ab0d7cef3313d91e652a89870c89b0c42760f9e (diff) | |
| download | catch3-77eae8bd2a2c8c3135d30649aa7c51b5bfc0e61e.tar.gz | |
Turn IResultCapture::lastAssertionPassed into a free function
The thread-safety changes in assertions & messages turned whether
the last assertion passed or failed into thread-local state,
instead of being member of the `RunContext`. However, this change
was not reflected in the API `CHECKED_IF`/`CHECKED_ELSE` used,
which in turn required `catch_test_macro_impl.hpp` to include
`catch_interfaces_capture.hpp` for it.
Thanks to the combination of this commit and the previous similar
commit for the message stack handling, the main include path does
not need to include `catch_interfaces_capture.hpp` anymore.
Diffstat (limited to 'src/catch2/internal/catch_run_context.cpp')
| -rw-r--r-- | src/catch2/internal/catch_run_context.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index 125ffc7b..547ff9d8 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -324,6 +324,9 @@ namespace Catch { void addUnscopedMessage( MessageInfo&& message ) { Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( message ) ); } + + bool lastAssertionPassed() { return Detail::g_lastAssertionPassed; } + } // namespace Detail RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter) @@ -720,10 +723,6 @@ namespace Catch { m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); } - bool RunContext::lastAssertionPassed() { - return Detail::g_lastAssertionPassed; - } - void RunContext::assertionPassedFastPath(SourceLineInfo lineInfo) { // We want to save the line info for better experience with unexpected assertions Detail::g_lastKnownLineInfo = lineInfo; @@ -953,7 +952,6 @@ namespace Catch { } } - void seedRng(IConfig const& config) { sharedRng().seed(config.rngSeed()); } |