mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-27 23:19:32 +00:00
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:
parent
ead139e094
commit
767f1588dc
14 changed files with 952 additions and 872 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue