mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 22:19:25 +00:00
parent
503d5d0c8e
commit
f3d1f08c3b
62 changed files with 527 additions and 527 deletions
|
@ -31,7 +31,7 @@ namespace Catch { namespace Detail {
|
|||
|
||||
namespace Catch {
|
||||
namespace {
|
||||
|
||||
|
||||
class Win32ColourImpl : public Detail::IColourImpl {
|
||||
public:
|
||||
Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) )
|
||||
|
@ -61,7 +61,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void setTextAttribute( WORD _textAttribute ) {
|
||||
SetConsoleTextAttribute( stdoutHandle, _textAttribute );
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace {
|
|||
inline bool shouldUseColourForPlatform() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Win32ColourImpl platformColourImpl;
|
||||
|
||||
} // end anon namespace
|
||||
|
@ -106,11 +106,11 @@ namespace {
|
|||
case Colour::BrightRed: return setColour( "[1;31m" );
|
||||
case Colour::BrightGreen: return setColour( "[1;32m" );
|
||||
case Colour::BrightWhite: return setColour( "[1;37m" );
|
||||
|
||||
|
||||
case Colour::Bright: throw std::logic_error( "not a colour" );
|
||||
}
|
||||
}
|
||||
private:
|
||||
private:
|
||||
void setColour( const char* _escapeCode ) {
|
||||
std::cout << '\033' << _escapeCode;
|
||||
}
|
||||
|
@ -119,9 +119,9 @@ namespace {
|
|||
inline bool shouldUseColourForPlatform() {
|
||||
return isatty( fileno(stdout) );
|
||||
}
|
||||
|
||||
|
||||
PosixColourImpl platformColourImpl;
|
||||
|
||||
|
||||
} // end anon namespace
|
||||
} // end namespace Catch
|
||||
|
||||
|
@ -133,7 +133,7 @@ namespace Catch {
|
|||
struct NoColourImpl : Detail::IColourImpl {
|
||||
void use( Colour::Code ) {}
|
||||
};
|
||||
NoColourImpl noColourImpl;
|
||||
NoColourImpl noColourImpl;
|
||||
static const bool shouldUseColour = shouldUseColourForPlatform() &&
|
||||
!isDebuggerActive();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue