This commit is contained in:
Phil Nash 2016-02-29 08:17:18 +00:00
parent f895e0d95f
commit ae5ee2cf63
3 changed files with 85 additions and 30 deletions

View File

@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png) ![catch logo](catch-logo-small.png)
*v1.3.4* *v1.3.5*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)

View File

@ -37,7 +37,7 @@ namespace Catch {
return os; return os;
} }
Version libraryVersion( 1, 3, 4, "", 0 ); Version libraryVersion( 1, 3, 5, "", 0 );
} }

View File

@ -1,6 +1,6 @@
/* /*
* Catch v1.3.4 * Catch v1.3.5
* Generated: 2016-02-10 19:24:03.089683 * Generated: 2016-02-29 08:16:42.342094
* ---------------------------------------------------------- * ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly * This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -102,6 +102,10 @@
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11 // All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
#if defined(__cplusplus) && __cplusplus >= 201103L
# define CATCH_CPP11_OR_GREATER
#endif
#ifdef __clang__ #ifdef __clang__
# if __has_feature(cxx_nullptr) # if __has_feature(cxx_nullptr)
@ -112,6 +116,10 @@
# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT # define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
# endif # endif
# if defined(CATCH_CPP11_OR_GREATER)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
# endif
#endif // __clang__ #endif // __clang__
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -136,9 +144,13 @@
// GCC // GCC
#ifdef __GNUC__ #ifdef __GNUC__
#if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) # if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
#endif # endif
# if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) && defined(CATCH_CPP11_OR_GREATER)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "gcc diagnostic ignored \"-Wparentheses\"" )
# endif
// - otherwise more recent versions define __cplusplus >= 201103L // - otherwise more recent versions define __cplusplus >= 201103L
// and will get picked up below // and will get picked up below
@ -177,9 +189,7 @@
// C++ language feature support // C++ language feature support
// catch all support for C++11 // catch all support for C++11
#if defined(__cplusplus) && __cplusplus >= 201103L #if defined(CATCH_CPP11_OR_GREATER)
# define CATCH_CPP11_OR_GREATER
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) # if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
@ -247,6 +257,10 @@
# define CATCH_CONFIG_CPP11_UNIQUE_PTR # define CATCH_CONFIG_CPP11_UNIQUE_PTR
#endif #endif
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
#endif
// noexcept support: // noexcept support:
#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT) #if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
# define CATCH_NOEXCEPT noexcept # define CATCH_NOEXCEPT noexcept
@ -1287,37 +1301,37 @@ namespace Internal {
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsEqualTo> { struct Evaluator<T1, T2, IsEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs) { static bool evaluate( T1 const& lhs, T2 const& rhs) {
return opCast( lhs ) == opCast( rhs ); return bool( opCast( lhs ) == opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsNotEqualTo> { struct Evaluator<T1, T2, IsNotEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) != opCast( rhs ); return bool( opCast( lhs ) != opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThan> { struct Evaluator<T1, T2, IsLessThan> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) < opCast( rhs ); return bool( opCast( lhs ) < opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThan> { struct Evaluator<T1, T2, IsGreaterThan> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) > opCast( rhs ); return bool( opCast( lhs ) > opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> { struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) >= opCast( rhs ); return bool( opCast( lhs ) >= opCast( rhs ) );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThanOrEqualTo> { struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
static bool evaluate( T1 const& lhs, T2 const& rhs ) { static bool evaluate( T1 const& lhs, T2 const& rhs ) {
return opCast( lhs ) <= opCast( rhs ); return bool( opCast( lhs ) <= opCast( rhs ) );
} }
}; };
@ -2020,6 +2034,7 @@ namespace Catch {
do { \ do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
try { \ try { \
CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
( __catchResult <= expr ).endExpression(); \ ( __catchResult <= expr ).endExpression(); \
} \ } \
catch( ... ) { \ catch( ... ) { \
@ -3331,6 +3346,11 @@ namespace Catch {
InLexicographicalOrder, InLexicographicalOrder,
InRandomOrder InRandomOrder
}; }; }; };
struct UseColour { enum YesOrNo {
Auto,
Yes,
No
}; };
class TestSpec; class TestSpec;
@ -3350,7 +3370,7 @@ namespace Catch {
virtual TestSpec const& testSpec() const = 0; virtual TestSpec const& testSpec() const = 0;
virtual RunTests::InWhatOrder runOrder() const = 0; virtual RunTests::InWhatOrder runOrder() const = 0;
virtual unsigned int rngSeed() const = 0; virtual unsigned int rngSeed() const = 0;
virtual bool forceColour() const = 0; virtual UseColour::YesOrNo useColour() const = 0;
}; };
} }
@ -3439,14 +3459,14 @@ namespace Catch {
noThrow( false ), noThrow( false ),
showHelp( false ), showHelp( false ),
showInvisibles( false ), showInvisibles( false ),
forceColour( false ),
filenamesAsTags( false ), filenamesAsTags( false ),
abortAfter( -1 ), abortAfter( -1 ),
rngSeed( 0 ), rngSeed( 0 ),
verbosity( Verbosity::Normal ), verbosity( Verbosity::Normal ),
warnings( WarnAbout::Nothing ), warnings( WarnAbout::Nothing ),
showDurations( ShowDurations::DefaultForReporter ), showDurations( ShowDurations::DefaultForReporter ),
runOrder( RunTests::InDeclarationOrder ) runOrder( RunTests::InDeclarationOrder ),
useColour( UseColour::Auto )
{} {}
bool listTests; bool listTests;
@ -3459,7 +3479,6 @@ namespace Catch {
bool noThrow; bool noThrow;
bool showHelp; bool showHelp;
bool showInvisibles; bool showInvisibles;
bool forceColour;
bool filenamesAsTags; bool filenamesAsTags;
int abortAfter; int abortAfter;
@ -3469,6 +3488,7 @@ namespace Catch {
WarnAbout::What warnings; WarnAbout::What warnings;
ShowDurations::OrNot showDurations; ShowDurations::OrNot showDurations;
RunTests::InWhatOrder runOrder; RunTests::InWhatOrder runOrder;
UseColour::YesOrNo useColour;
std::string outputFilename; std::string outputFilename;
std::string name; std::string name;
@ -3534,7 +3554,7 @@ namespace Catch {
virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; }
virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; } virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; }
virtual unsigned int rngSeed() const { return m_data.rngSeed; } virtual unsigned int rngSeed() const { return m_data.rngSeed; }
virtual bool forceColour() const { return m_data.forceColour; } virtual UseColour::YesOrNo useColour() const { return m_data.useColour; }
private: private:
@ -4624,6 +4644,21 @@ namespace Catch {
? ShowDurations::Always ? ShowDurations::Always
: ShowDurations::Never; : ShowDurations::Never;
} }
inline void setUseColour( ConfigData& config, std::string const& value ) {
std::string mode = toLower( value );
if( mode == "yes" )
config.useColour = UseColour::Yes;
else if( mode == "no" )
config.useColour = UseColour::No;
else if( mode == "auto" )
config.useColour = UseColour::Auto;
else
throw std::runtime_error( "colour mode must be one of: auto, yes or no" );
}
inline void forceColour( ConfigData& config ) {
config.useColour = UseColour::Yes;
}
inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) { inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) {
std::ifstream f( _filename.c_str() ); std::ifstream f( _filename.c_str() );
if( !f.is_open() ) if( !f.is_open() )
@ -4710,7 +4745,7 @@ namespace Catch {
cli["-d"]["--durations"] cli["-d"]["--durations"]
.describe( "show test durations" ) .describe( "show test durations" )
.bind( &setShowDurations, "yes/no" ); .bind( &setShowDurations, "yes|no" );
cli["-f"]["--input-file"] cli["-f"]["--input-file"]
.describe( "load test names to run from a file" ) .describe( "load test names to run from a file" )
@ -4738,8 +4773,12 @@ namespace Catch {
.bind( &setRngSeed, "'time'|number" ); .bind( &setRngSeed, "'time'|number" );
cli["--force-colour"] cli["--force-colour"]
.describe( "force colourised output" ) .describe( "force colourised output (deprecated)" )
.bind( &ConfigData::forceColour ); .bind( &forceColour );
cli["--use-colour"]
.describe( "should output be colourised" )
.bind( &setUseColour, "yes|no" );
return cli; return cli;
} }
@ -6971,7 +7010,18 @@ namespace {
IColourImpl* platformColourInstance() { IColourImpl* platformColourInstance() {
static Win32ColourImpl s_instance; static Win32ColourImpl s_instance;
return &s_instance;
Ptr<IConfig const> config = getCurrentContext().getConfig();
UseColour::YesOrNo colourMode = config
? config->useColour()
: UseColour::Auto;
if( colourMode == UseColour::Auto )
colourMode = !isDebuggerActive()
? UseColour::Yes
: UseColour::No;
return colourMode == UseColour::Yes
? &s_instance
: NoColourImpl::instance();
} }
} // end anon namespace } // end anon namespace
@ -7022,7 +7072,14 @@ namespace {
IColourImpl* platformColourInstance() { IColourImpl* platformColourInstance() {
Ptr<IConfig const> config = getCurrentContext().getConfig(); Ptr<IConfig const> config = getCurrentContext().getConfig();
return (config && config->forceColour()) || isatty(STDOUT_FILENO) UseColour::YesOrNo colourMode = config
? config->useColour()
: UseColour::Auto;
if( colourMode == UseColour::Auto )
colourMode = (!isDebuggerActive() && isatty(STDOUT_FILENO) )
? UseColour::Yes
: UseColour::No;
return colourMode == UseColour::Yes
? PosixColourImpl::instance() ? PosixColourImpl::instance()
: NoColourImpl::instance(); : NoColourImpl::instance();
} }
@ -7047,9 +7104,7 @@ namespace Catch {
Colour::~Colour(){ if( !m_moved ) use( None ); } Colour::~Colour(){ if( !m_moved ) use( None ); }
void Colour::use( Code _colourCode ) { void Colour::use( Code _colourCode ) {
static IColourImpl* impl = isDebuggerActive() static IColourImpl* impl = platformColourInstance();
? NoColourImpl::instance()
: platformColourInstance();
impl->use( _colourCode ); impl->use( _colourCode );
} }
@ -7426,7 +7481,7 @@ namespace Catch {
return os; return os;
} }
Version libraryVersion( 1, 3, 4, "", 0 ); Version libraryVersion( 1, 3, 5, "", 0 );
} }