Add a BrightYellow colour, also use it for reconstructed exprs

Closes #979
This commit is contained in:
Martin Hořeňovský 2018-01-26 23:04:54 +01:00 committed by Phil Nash
parent 126850e76b
commit 1ab6be30a2
2 changed files with 13 additions and 6 deletions

View File

@ -11,8 +11,8 @@
# pragma clang diagnostic push # pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wexit-time-destructors" # pragma clang diagnostic ignored "-Wexit-time-destructors"
#endif #endif
#include "catch_console_colour.h" #include "catch_console_colour.h"
#include "catch_enforce.h" #include "catch_enforce.h"
#include "catch_errno_guard.h" #include "catch_errno_guard.h"
@ -84,8 +84,12 @@ namespace {
case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED ); case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );
case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN ); case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );
case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN );
case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
default:
CATCH_ERROR( "Unknown colour requested" );
} }
} }
@ -143,8 +147,10 @@ namespace {
case Colour::BrightRed: return setColour( "[1;31m" ); case Colour::BrightRed: return setColour( "[1;31m" );
case Colour::BrightGreen: return setColour( "[1;32m" ); case Colour::BrightGreen: return setColour( "[1;32m" );
case Colour::BrightWhite: return setColour( "[1;37m" ); case Colour::BrightWhite: return setColour( "[1;37m" );
case Colour::BrightYellow: return setColour( "[1;33m" );
case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
default: CATCH_INTERNAL_ERROR( "Unknown colour requested" );
} }
} }
static IColourImpl* instance() { static IColourImpl* instance() {
@ -196,7 +202,7 @@ namespace Catch {
namespace Catch { namespace Catch {
Colour::Colour( Code _colourCode ) { use( _colourCode ); } Colour::Colour( Code _colourCode ) { use( _colourCode ); }
Colour::Colour( Colour&& rhs ) noexcept { Colour::Colour( Colour&& rhs ) noexcept {
m_moved = rhs.m_moved; m_moved = rhs.m_moved;
rhs.m_moved = true; rhs.m_moved = true;
} }
@ -205,7 +211,7 @@ namespace Catch {
rhs.m_moved = true; rhs.m_moved = true;
return *this; return *this;
} }
Colour::~Colour(){ if( !m_moved ) use( None ); } Colour::~Colour(){ if( !m_moved ) use( None ); }
void Colour::use( Code _colourCode ) { void Colour::use( Code _colourCode ) {

View File

@ -30,10 +30,11 @@ namespace Catch {
BrightGreen = Bright | Green, BrightGreen = Bright | Green,
LightGrey = Bright | Grey, LightGrey = Bright | Grey,
BrightWhite = Bright | White, BrightWhite = Bright | White,
BrightYellow = Bright | Yellow,
// By intention // By intention
FileName = LightGrey, FileName = LightGrey,
Warning = Yellow, Warning = BrightYellow,
ResultError = BrightRed, ResultError = BrightRed,
ResultSuccess = BrightGreen, ResultSuccess = BrightGreen,
ResultExpectedFailure = Warning, ResultExpectedFailure = Warning,
@ -42,7 +43,7 @@ namespace Catch {
Success = Green, Success = Green,
OriginalExpression = Cyan, OriginalExpression = Cyan,
ReconstructedExpression = Yellow, ReconstructedExpression = BrightYellow,
SecondaryText = LightGrey, SecondaryText = LightGrey,
Headers = White Headers = White