Add unscoped info functionality

This adds UNSCOPED_INFO macro, creating a log message that is stored
until the end of next assertion or the end of test case, whichever comes
first. These messages are not scoped locally, unlike messages created by
INFO macro.
This commit is contained in:
Omer Ozarslan authored and Martin Hořeňovský committed 2019-03-06 22:04:35 +01:00
1 parent 1a03918455
commit 99575b45db
7 files changed
+32 -2

No files matched your search

+8 -2
View File
@@ -47,14 +47,20 @@ namespace Catch {
ScopedMessage::ScopedMessage( MessageBuilder const& builder )
: m_info( builder.m_info )
: m_info( builder.m_info ), m_moved()
{
m_info.message = builder.m_stream.str();
getResultCapture().pushScopedMessage( m_info );
}
ScopedMessage::ScopedMessage( ScopedMessage&& old )
: m_info( old.m_info ), m_moved()
{
old.m_moved = true;
}
ScopedMessage::~ScopedMessage() {
if ( !uncaught_exceptions() ){
if ( !uncaught_exceptions() && !m_moved ){
getResultCapture().popScopedMessage(m_info);
}
}