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.
This commit is contained in:
Martin Hořeňovský committed 2026-04-07 14:33:39 +02:00
1 parent 3ab0d7cef3
commit 77eae8bd2a
4 files changed
+12 -14

No files matched your search

+3 -5
View File
@@ -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());
}