Added StringMaker (for partially specialising string conversions), extended BDD macros and moved file/line info to top of message.

Re-enable ANSI colour by default - hopefully properly excluding Windows this time
This commit is contained in:
Phil Nash 2013-03-04 12:19:15 +01:00
parent ead139e094
commit 767f1588dc
14 changed files with 952 additions and 872 deletions

View file

@ -10,6 +10,10 @@
#include "catch_console_colour.hpp"
#if !defined(CATCH_CONFIG_USE_ANSI_COLOUR_CODES) && !defined(CATCH_PLATFORM_WINDOWS)
#define CATCH_CONFIG_USE_ANSI_COLOUR_CODES 1
#endif
#if defined( CATCH_CONFIG_USE_ANSI_COLOUR_CODES )
#include <unistd.h>
@ -31,8 +35,15 @@ namespace Catch {
namespace { const char colourEscape = '\033'; }
inline bool shouldUseColour() {
static bool s_shouldUseColour
= CATCH_CONFIG_USE_ANSI_COLOUR_CODES != 0 &&
isatty( fileno(stdout) ) &&
!isDebuggerActive();
return s_shouldUseColour;
}
void TextColour::set( Colours colour ) {
if( isatty( fileno(stdout) ) && !isDebuggerActive() ) {
if( shouldUseColour() ) {
switch( colour ) {
case TextColour::FileName:
std::cout << colourEscape << "[0m"; // white/ normal