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

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/catch_message.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-09-23 11:01:27 +0200
committerMartin Hořeňovský2025-09-23 11:46:26 +0200
commit434bf55d4727ab1d1aef244ef16823a0ed1e6b4a (patch)
treee891786493ba589f694459bc85f246e5a6d3e862 /src/catch2/catch_message.cpp
parent9048c24fa7c6b568d52f76cbf06bbd62b7f83556 (diff)
downloadcatch3-434bf55d4727ab1d1aef244ef16823a0ed1e6b4a.tar.gz
Make message push/pop static
Since the change to make the message macros thread-safe, and thus thread-local, there is no need to handle messages through instance of `RunContext`.
Diffstat (limited to 'src/catch2/catch_message.cpp')
-rw-r--r--src/catch2/catch_message.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/catch2/catch_message.cpp b/src/catch2/catch_message.cpp
index 1ea8c299..dc7d5678 100644
--- a/src/catch2/catch_message.cpp
+++ b/src/catch2/catch_message.cpp
@@ -22,7 +22,7 @@ namespace Catch {
m_messageId( builder.m_info.sequence ) {
MessageInfo info( CATCH_MOVE( builder.m_info ) );
info.message = builder.m_stream.str();
- getResultCapture().pushScopedMessage( CATCH_MOVE(info) );
+ IResultCapture::pushScopedMessage( CATCH_MOVE( info ) );
}
ScopedMessage::ScopedMessage( ScopedMessage&& old ) noexcept:
@@ -31,15 +31,14 @@ namespace Catch {
}
ScopedMessage::~ScopedMessage() {
- if ( !m_moved ) { getResultCapture().popScopedMessage( m_messageId ); }
+ if ( !m_moved ) { IResultCapture::popScopedMessage( m_messageId ); }
}
Capturer::Capturer( StringRef macroName,
SourceLineInfo const& lineInfo,
ResultWas::OfType resultType,
- StringRef names ):
- m_resultCapture( getResultCapture() ) {
+ StringRef names ) {
auto trimmed = [&] (size_t start, size_t end) {
while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {
++start;
@@ -101,14 +100,14 @@ namespace Catch {
Capturer::~Capturer() {
assert( m_captured == m_messages.size() );
for (auto const& message : m_messages) {
- m_resultCapture.popScopedMessage( message.sequence );
+ IResultCapture::popScopedMessage( message.sequence );
}
}
void Capturer::captureValue( size_t index, std::string const& value ) {
assert( index < m_messages.size() );
m_messages[index].message += value;
- m_resultCapture.pushScopedMessage( CATCH_MOVE(m_messages[index]) );
+ IResultCapture::pushScopedMessage( CATCH_MOVE( m_messages[index] ) );
m_captured++;
}