forked from catchorg/Catch2
ColourGuard is no longer constructed engaged
Forcing it to be engaged explicitly, either via `op<<`, or by `ColourGuard::engage`, fixes an issue with multiple `ColourGuard`s being constructed in a single expression. Because the construction of the `ColourGuard` instances can happen in arbitrary order, colours would be applied in arbitrary order too. However, a chain of `op<<`s has strict call orders, fixing this issue.
This commit is contained in:
@@ -153,7 +153,7 @@ namespace Catch {
|
||||
m_startupExceptions = true;
|
||||
auto errStream = makeStream( "%stderr" );
|
||||
auto colourImpl = makeColourImpl( &config(), errStream.get() );
|
||||
auto guard = colourImpl->startColour( Colour::Red );
|
||||
auto guard = colourImpl->guardColour( Colour::Red );
|
||||
errStream->stream() << "Errors occurred during startup!" << '\n';
|
||||
// iterate over all exceptions and notify user
|
||||
for ( const auto& ex_ptr : exceptions ) {
|
||||
@@ -200,7 +200,7 @@ namespace Catch {
|
||||
auto colour = makeColourImpl( &config(), errStream.get() );
|
||||
|
||||
errStream->stream()
|
||||
<< colour->startColour( Colour::Red )
|
||||
<< colour->guardColour( Colour::Red )
|
||||
<< "\nError(s) in input:\n"
|
||||
<< TextFlow::Column( result.errorMessage() ).indent( 2 )
|
||||
<< "\n\n";
|
||||
|
||||
Reference in New Issue
Block a user