diff options
| author | Martin Hořeňovský | 2025-09-23 11:01:27 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2025-09-23 11:46:26 +0200 |
| commit | 434bf55d4727ab1d1aef244ef16823a0ed1e6b4a (patch) | |
| tree | e891786493ba589f694459bc85f246e5a6d3e862 /src/catch2/catch_message.cpp | |
| parent | 9048c24fa7c6b568d52f76cbf06bbd62b7f83556 (diff) | |
| download | catch3-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.cpp | 11 |
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++; } |