diff options
| author | Martin Hořeňovský | 2022-03-21 23:20:08 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-03-24 16:02:54 +0100 |
| commit | 081a1e9abaf32a759fd08a01fcf7a65860f91a63 (patch) | |
| tree | 2bbc0f40950d524596e4aa3b79b665ca3eb89adb /src/catch2/catch_session.cpp | |
| parent | 4d8acafecb973d9b03178346c3f1566fe7485fb1 (diff) | |
| download | catch3-081a1e9abaf32a759fd08a01fcf7a65860f91a63.tar.gz | |
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.
Diffstat (limited to 'src/catch2/catch_session.cpp')
| -rw-r--r-- | src/catch2/catch_session.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index 3a47974d..c685e48b 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -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"; |