Skip to content

Commit

Permalink
Add a BrightYellow colour, also use it for reconstructed exprs
Browse files Browse the repository at this point in the history
Closes #979
  • Loading branch information
horenmar authored and philsquared committed Feb 1, 2018
1 parent 126850e commit 1ab6be3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 10 additions & 4 deletions include/internal/catch_console_colour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wexit-time-destructors"
#endif


#include "catch_console_colour.h"
#include "catch_enforce.h"
#include "catch_errno_guard.h"
Expand Down Expand Up @@ -84,8 +84,12 @@ namespace {
case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );
case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );
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" );

default:
CATCH_ERROR( "Unknown colour requested" );
}
}

Expand Down Expand Up @@ -143,8 +147,10 @@ namespace {
case Colour::BrightRed: return setColour( "[1;31m" );
case Colour::BrightGreen: return setColour( "[1;32m" );
case Colour::BrightWhite: return setColour( "[1;37m" );
case Colour::BrightYellow: return setColour( "[1;33m" );

case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
default: CATCH_INTERNAL_ERROR( "Unknown colour requested" );
}
}
static IColourImpl* instance() {
Expand Down Expand Up @@ -196,7 +202,7 @@ namespace Catch {
namespace Catch {

Colour::Colour( Code _colourCode ) { use( _colourCode ); }
Colour::Colour( Colour&& rhs ) noexcept {
Colour::Colour( Colour&& rhs ) noexcept {
m_moved = rhs.m_moved;
rhs.m_moved = true;
}
Expand All @@ -205,7 +211,7 @@ namespace Catch {
rhs.m_moved = true;
return *this;
}

Colour::~Colour(){ if( !m_moved ) use( None ); }

void Colour::use( Code _colourCode ) {
Expand Down
5 changes: 3 additions & 2 deletions include/internal/catch_console_colour.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ namespace Catch {
BrightGreen = Bright | Green,
LightGrey = Bright | Grey,
BrightWhite = Bright | White,
BrightYellow = Bright | Yellow,

// By intention
FileName = LightGrey,
Warning = Yellow,
Warning = BrightYellow,
ResultError = BrightRed,
ResultSuccess = BrightGreen,
ResultExpectedFailure = Warning,
Expand All @@ -42,7 +43,7 @@ namespace Catch {
Success = Green,

OriginalExpression = Cyan,
ReconstructedExpression = Yellow,
ReconstructedExpression = BrightYellow,

SecondaryText = LightGrey,
Headers = White
Expand Down

0 comments on commit 1ab6be3

Please sign in to comment.