updated catch
This commit is contained in:
parent
4c31de262e
commit
5993ff9976
1 changed files with 125 additions and 169 deletions
294
test/catch.hpp
294
test/catch.hpp
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* CATCH v1.1 build 3 (master branch)
|
* Catch v1.2.1
|
||||||
* Generated: 2015-05-21 06:16:00.388118
|
* Generated: 2015-06-30 18:23:27.961086
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* 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.
|
||||||
|
@ -87,19 +87,23 @@
|
||||||
|
|
||||||
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
|
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
|
||||||
|
|
||||||
// CATCH_CONFIG_SFINAE : is basic (C++03) SFINAE supported?
|
|
||||||
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
|
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
|
||||||
|
|
||||||
// A lot of this code is based on Boost (1.53)
|
// In general each macro has a _NO_<feature name> form
|
||||||
|
// (e.g. CATCH_CONFIG_CPP11_NO_NULLPTR) which disables the feature.
|
||||||
|
// Many features, at point of detection, define an _INTERNAL_ macro, so they
|
||||||
|
// can be combined, en-mass, with the _NO_ forms later.
|
||||||
|
|
||||||
|
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
|
|
||||||
# if __has_feature(cxx_nullptr)
|
# if __has_feature(cxx_nullptr)
|
||||||
# define CATCH_CONFIG_CPP11_NULLPTR
|
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if __has_feature(cxx_noexcept)
|
# if __has_feature(cxx_noexcept)
|
||||||
# define CATCH_CONFIG_CPP11_NOEXCEPT
|
# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif // __clang__
|
#endif // __clang__
|
||||||
|
@ -108,51 +112,26 @@
|
||||||
// Borland
|
// Borland
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
|
|
||||||
#if (__BORLANDC__ > 0x582 )
|
|
||||||
//#define CATCH_CONFIG_SFINAE // Not confirmed
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __BORLANDC__
|
#endif // __BORLANDC__
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// EDG
|
// EDG
|
||||||
#ifdef __EDG_VERSION__
|
#ifdef __EDG_VERSION__
|
||||||
|
|
||||||
#if (__EDG_VERSION__ > 238 )
|
|
||||||
//#define CATCH_CONFIG_SFINAE // Not confirmed
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __EDG_VERSION__
|
#endif // __EDG_VERSION__
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Digital Mars
|
// Digital Mars
|
||||||
#ifdef __DMC__
|
#ifdef __DMC__
|
||||||
|
|
||||||
#if (__DMC__ > 0x840 )
|
|
||||||
//#define CATCH_CONFIG_SFINAE // Not confirmed
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __DMC__
|
#endif // __DMC__
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// GCC
|
// GCC
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
||||||
#if __GNUC__ < 3
|
|
||||||
|
|
||||||
#if (__GNUC_MINOR__ >= 96 )
|
|
||||||
//#define CATCH_CONFIG_SFINAE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif __GNUC__ >= 3
|
|
||||||
|
|
||||||
// #define CATCH_CONFIG_SFINAE // Taking this out completely for now
|
|
||||||
|
|
||||||
#endif // __GNUC__ < 3
|
|
||||||
|
|
||||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) )
|
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) )
|
||||||
|
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||||
#define CATCH_CONFIG_CPP11_NULLPTR
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __GNUC__
|
#endif // __GNUC__
|
||||||
|
@ -161,17 +140,13 @@
|
||||||
// Visual C++
|
// Visual C++
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
#if (_MSC_VER >= 1310 ) // (VC++ 7.0+)
|
|
||||||
//#define CATCH_CONFIG_SFINAE // Not confirmed
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (_MSC_VER >= 1600)
|
#if (_MSC_VER >= 1600)
|
||||||
#define CATCH_CONFIG_CPP11_NULLPTR
|
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
|
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
|
||||||
#define CATCH_CONFIG_CPP11_NOEXCEPT
|
#define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||||
#define CATCH_CONFIG_CPP11_GENERATED_METHODS
|
#define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
@ -182,9 +157,7 @@
|
||||||
( defined __GNUC__ && __GNUC__ >= 3 ) || \
|
( defined __GNUC__ && __GNUC__ >= 3 ) || \
|
||||||
( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L )
|
( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L )
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_NO_VARIADIC_MACROS
|
#define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
|
||||||
#define CATCH_CONFIG_VARIADIC_MACROS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -196,36 +169,52 @@
|
||||||
|
|
||||||
# define CATCH_CPP11_OR_GREATER
|
# define CATCH_CPP11_OR_GREATER
|
||||||
|
|
||||||
# ifndef CATCH_CONFIG_CPP11_NULLPTR
|
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR)
|
||||||
# define CATCH_CONFIG_CPP11_NULLPTR
|
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef CATCH_CONFIG_CPP11_NOEXCEPT
|
# ifndef CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||||
# define CATCH_CONFIG_CPP11_NOEXCEPT
|
# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef CATCH_CONFIG_CPP11_GENERATED_METHODS
|
# ifndef CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
|
||||||
# define CATCH_CONFIG_CPP11_GENERATED_METHODS
|
# define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef CATCH_CONFIG_CPP11_IS_ENUM
|
# ifndef CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM
|
||||||
# define CATCH_CONFIG_CPP11_IS_ENUM
|
# define CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef CATCH_CONFIG_CPP11_TUPLE
|
# ifndef CATCH_INTERNAL_CONFIG_CPP11_TUPLE
|
||||||
# define CATCH_CONFIG_CPP11_TUPLE
|
# define CATCH_INTERNAL_CONFIG_CPP11_TUPLE
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef CATCH_CONFIG_SFINAE
|
# ifndef CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
|
||||||
//# define CATCH_CONFIG_SFINAE // Don't use, for now
|
# define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef CATCH_CONFIG_VARIADIC_MACROS
|
|
||||||
# define CATCH_CONFIG_VARIADIC_MACROS
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif // __cplusplus >= 201103L
|
#endif // __cplusplus >= 201103L
|
||||||
|
|
||||||
|
// Now set the actual defines based on the above + anything the user has configured
|
||||||
|
#if defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) && !defined(CATCH_CONFIG_CPP11_NO_NULLPTR) && !defined(CATCH_CONFIG_CPP11_NULLPTR) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||||
|
# define CATCH_CONFIG_CPP11_NULLPTR
|
||||||
|
#endif
|
||||||
|
#if defined(CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_CONFIG_CPP11_NO_NOEXCEPT) && !defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||||
|
# define CATCH_CONFIG_CPP11_NOEXCEPT
|
||||||
|
#endif
|
||||||
|
#if defined(CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS) && !defined(CATCH_CONFIG_CPP11_NO_GENERATED_METHODS) && !defined(CATCH_CONFIG_CPP11_GENERATED_METHODS) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||||
|
# define CATCH_CONFIG_CPP11_GENERATED_METHODS
|
||||||
|
#endif
|
||||||
|
#if defined(CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM) && !defined(CATCH_CONFIG_CPP11_NO_IS_ENUM) && !defined(CATCH_CONFIG_CPP11_IS_ENUM) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||||
|
# define CATCH_CONFIG_CPP11_IS_ENUM
|
||||||
|
#endif
|
||||||
|
#if defined(CATCH_INTERNAL_CONFIG_CPP11_TUPLE) && !defined(CATCH_CONFIG_CPP11_NO_TUPLE) && !defined(CATCH_CONFIG_CPP11_TUPLE) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||||
|
# define CATCH_CONFIG_CPP11_TUPLE
|
||||||
|
#endif
|
||||||
|
#if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS)
|
||||||
|
#define CATCH_CONFIG_VARIADIC_MACROS
|
||||||
|
#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
|
||||||
|
@ -798,8 +787,8 @@ namespace Catch {
|
||||||
ResultDisposition::Flags resultDisposition );
|
ResultDisposition::Flags resultDisposition );
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ExpressionLhs<T const&> operator->* ( T const& operand );
|
ExpressionLhs<T const&> operator <= ( T const& operand );
|
||||||
ExpressionLhs<bool> operator->* ( bool value );
|
ExpressionLhs<bool> operator <= ( bool value );
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ResultBuilder& operator << ( T const& value ) {
|
ResultBuilder& operator << ( T const& value ) {
|
||||||
|
@ -1022,40 +1011,6 @@ namespace Internal {
|
||||||
// #included from: catch_tostring.h
|
// #included from: catch_tostring.h
|
||||||
#define TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
|
||||||
|
|
||||||
// #included from: catch_sfinae.hpp
|
|
||||||
#define TWOBLUECUBES_CATCH_SFINAE_HPP_INCLUDED
|
|
||||||
|
|
||||||
// Try to detect if the current compiler supports SFINAE
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
struct TrueType {
|
|
||||||
static const bool value = true;
|
|
||||||
typedef void Enable;
|
|
||||||
char sizer[1];
|
|
||||||
};
|
|
||||||
struct FalseType {
|
|
||||||
static const bool value = false;
|
|
||||||
typedef void Disable;
|
|
||||||
char sizer[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef CATCH_CONFIG_SFINAE
|
|
||||||
|
|
||||||
template<bool> struct NotABooleanExpression;
|
|
||||||
|
|
||||||
template<bool c> struct If : NotABooleanExpression<c> {};
|
|
||||||
template<> struct If<true> : TrueType {};
|
|
||||||
template<> struct If<false> : FalseType {};
|
|
||||||
|
|
||||||
template<int size> struct SizedIf;
|
|
||||||
template<> struct SizedIf<sizeof(TrueType)> : TrueType {};
|
|
||||||
template<> struct SizedIf<sizeof(FalseType)> : FalseType {};
|
|
||||||
|
|
||||||
#endif // CATCH_CONFIG_SFINAE
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
@ -1154,32 +1109,13 @@ namespace Detail {
|
||||||
|
|
||||||
extern std::string unprintableString;
|
extern std::string unprintableString;
|
||||||
|
|
||||||
// SFINAE is currently disabled by default for all compilers.
|
|
||||||
// If the non SFINAE version of IsStreamInsertable is ambiguous for you
|
|
||||||
// and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE
|
|
||||||
#ifdef CATCH_CONFIG_SFINAE
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class IsStreamInsertableHelper {
|
|
||||||
template<int N> struct TrueIfSizeable : TrueType {};
|
|
||||||
|
|
||||||
template<typename T2>
|
|
||||||
static TrueIfSizeable<sizeof((*(std::ostream*)0) << *((T2 const*)0))> dummy(T2*);
|
|
||||||
static FalseType dummy(...);
|
|
||||||
|
|
||||||
public:
|
|
||||||
typedef SizedIf<sizeof(dummy((T*)0))> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct IsStreamInsertable : IsStreamInsertableHelper<T>::type {};
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
struct BorgType {
|
struct BorgType {
|
||||||
template<typename T> BorgType( T const& );
|
template<typename T> BorgType( T const& );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TrueType { char sizer[1]; };
|
||||||
|
struct FalseType { char sizer[2]; };
|
||||||
|
|
||||||
TrueType& testStreamable( std::ostream& );
|
TrueType& testStreamable( std::ostream& );
|
||||||
FalseType testStreamable( FalseType );
|
FalseType testStreamable( FalseType );
|
||||||
|
|
||||||
|
@ -1192,8 +1128,6 @@ namespace Detail {
|
||||||
enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) };
|
enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_CPP11_IS_ENUM)
|
#if defined(CATCH_CONFIG_CPP11_IS_ENUM)
|
||||||
template<typename T,
|
template<typename T,
|
||||||
bool IsEnum = std::is_enum<T>::value
|
bool IsEnum = std::is_enum<T>::value
|
||||||
|
@ -1461,11 +1395,11 @@ private:
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline ExpressionLhs<T const&> ResultBuilder::operator->* ( T const& operand ) {
|
inline ExpressionLhs<T const&> ResultBuilder::operator <= ( T const& operand ) {
|
||||||
return ExpressionLhs<T const&>( *this, operand );
|
return ExpressionLhs<T const&>( *this, operand );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ExpressionLhs<bool> ResultBuilder::operator->* ( bool value ) {
|
inline ExpressionLhs<bool> ResultBuilder::operator <= ( bool value ) {
|
||||||
return ExpressionLhs<bool>( *this, value );
|
return ExpressionLhs<bool>( *this, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1637,7 +1571,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 { \
|
||||||
( __catchResult->*expr ).endExpression(); \
|
( __catchResult <= expr ).endExpression(); \
|
||||||
} \
|
} \
|
||||||
catch( ... ) { \
|
catch( ... ) { \
|
||||||
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
|
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
|
||||||
|
@ -5016,32 +4950,15 @@ namespace SectionTracking {
|
||||||
|
|
||||||
RunState runState() const { return m_runState; }
|
RunState runState() const { return m_runState; }
|
||||||
|
|
||||||
TrackedSection* findChild( std::string const& childName ) {
|
TrackedSection* findChild( std::string const& childName );
|
||||||
TrackedSections::iterator it = m_children.find( childName );
|
TrackedSection* acquireChild( std::string const& childName );
|
||||||
return it != m_children.end()
|
|
||||||
? &it->second
|
|
||||||
: NULL;
|
|
||||||
}
|
|
||||||
TrackedSection* acquireChild( std::string const& childName ) {
|
|
||||||
if( TrackedSection* child = findChild( childName ) )
|
|
||||||
return child;
|
|
||||||
m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
|
|
||||||
return findChild( childName );
|
|
||||||
}
|
|
||||||
void enter() {
|
void enter() {
|
||||||
if( m_runState == NotStarted )
|
if( m_runState == NotStarted )
|
||||||
m_runState = Executing;
|
m_runState = Executing;
|
||||||
}
|
}
|
||||||
void leave() {
|
void leave();
|
||||||
for( TrackedSections::const_iterator it = m_children.begin(), itEnd = m_children.end();
|
|
||||||
it != itEnd;
|
|
||||||
++it )
|
|
||||||
if( it->second.runState() != Completed ) {
|
|
||||||
m_runState = ExecutingChildren;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_runState = Completed;
|
|
||||||
}
|
|
||||||
TrackedSection* getParent() {
|
TrackedSection* getParent() {
|
||||||
return m_parent;
|
return m_parent;
|
||||||
}
|
}
|
||||||
|
@ -5054,9 +4971,31 @@ namespace SectionTracking {
|
||||||
RunState m_runState;
|
RunState m_runState;
|
||||||
TrackedSections m_children;
|
TrackedSections m_children;
|
||||||
TrackedSection* m_parent;
|
TrackedSection* m_parent;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline TrackedSection* TrackedSection::findChild( std::string const& childName ) {
|
||||||
|
TrackedSections::iterator it = m_children.find( childName );
|
||||||
|
return it != m_children.end()
|
||||||
|
? &it->second
|
||||||
|
: NULL;
|
||||||
|
}
|
||||||
|
inline TrackedSection* TrackedSection::acquireChild( std::string const& childName ) {
|
||||||
|
if( TrackedSection* child = findChild( childName ) )
|
||||||
|
return child;
|
||||||
|
m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
|
||||||
|
return findChild( childName );
|
||||||
|
}
|
||||||
|
inline void TrackedSection::leave() {
|
||||||
|
for( TrackedSections::const_iterator it = m_children.begin(), itEnd = m_children.end();
|
||||||
|
it != itEnd;
|
||||||
|
++it )
|
||||||
|
if( it->second.runState() != Completed ) {
|
||||||
|
m_runState = ExecutingChildren;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_runState = Completed;
|
||||||
|
}
|
||||||
|
|
||||||
class TestCaseTracker {
|
class TestCaseTracker {
|
||||||
public:
|
public:
|
||||||
TestCaseTracker( std::string const& testCaseName )
|
TestCaseTracker( std::string const& testCaseName )
|
||||||
|
@ -5539,18 +5478,19 @@ namespace Catch {
|
||||||
struct Version {
|
struct Version {
|
||||||
Version( unsigned int _majorVersion,
|
Version( unsigned int _majorVersion,
|
||||||
unsigned int _minorVersion,
|
unsigned int _minorVersion,
|
||||||
unsigned int _buildNumber,
|
unsigned int _patchNumber,
|
||||||
char const* const _branchName )
|
std::string const& _branchName,
|
||||||
: majorVersion( _majorVersion ),
|
unsigned int _buildNumber );
|
||||||
minorVersion( _minorVersion ),
|
|
||||||
buildNumber( _buildNumber ),
|
|
||||||
branchName( _branchName )
|
|
||||||
{}
|
|
||||||
|
|
||||||
unsigned int const majorVersion;
|
unsigned int const majorVersion;
|
||||||
unsigned int const minorVersion;
|
unsigned int const minorVersion;
|
||||||
|
unsigned int const patchNumber;
|
||||||
|
|
||||||
|
// buildNumber is only used if branchName is not null
|
||||||
|
std::string const branchName;
|
||||||
unsigned int const buildNumber;
|
unsigned int const buildNumber;
|
||||||
char const* const branchName;
|
|
||||||
|
friend std::ostream& operator << ( std::ostream& os, Version const& version );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void operator=( Version const& );
|
void operator=( Version const& );
|
||||||
|
@ -5670,12 +5610,7 @@ namespace Catch {
|
||||||
}
|
}
|
||||||
|
|
||||||
void showHelp( std::string const& processName ) {
|
void showHelp( std::string const& processName ) {
|
||||||
Catch::cout() << "\nCatch v" << libraryVersion.majorVersion << "."
|
Catch::cout() << "\nCatch v" << libraryVersion << "\n";
|
||||||
<< libraryVersion.minorVersion << " build "
|
|
||||||
<< libraryVersion.buildNumber;
|
|
||||||
if( libraryVersion.branchName != std::string( "master" ) )
|
|
||||||
Catch::cout() << " (" << libraryVersion.branchName << " branch)";
|
|
||||||
Catch::cout() << "\n";
|
|
||||||
|
|
||||||
m_cli.usage( Catch::cout(), processName );
|
m_cli.usage( Catch::cout(), processName );
|
||||||
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
||||||
|
@ -5692,9 +5627,10 @@ namespace Catch {
|
||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
{
|
{
|
||||||
Colour colourGuard( Colour::Red );
|
Colour colourGuard( Colour::Red );
|
||||||
Catch::cerr() << "\nError(s) in input:\n"
|
Catch::cerr()
|
||||||
<< Text( ex.what(), TextAttributes().setIndent(2) )
|
<< "\nError(s) in input:\n"
|
||||||
<< "\n\n";
|
<< Text( ex.what(), TextAttributes().setIndent(2) )
|
||||||
|
<< "\n\n";
|
||||||
}
|
}
|
||||||
m_cli.usage( Catch::cout(), m_configData.processName );
|
m_cli.usage( Catch::cout(), m_configData.processName );
|
||||||
return (std::numeric_limits<int>::max)();
|
return (std::numeric_limits<int>::max)();
|
||||||
|
@ -6806,8 +6742,33 @@ namespace Catch {
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
// These numbers are maintained by a script
|
Version::Version
|
||||||
Version libraryVersion( 1, 1, 3, "master" );
|
( unsigned int _majorVersion,
|
||||||
|
unsigned int _minorVersion,
|
||||||
|
unsigned int _patchNumber,
|
||||||
|
std::string const& _branchName,
|
||||||
|
unsigned int _buildNumber )
|
||||||
|
: majorVersion( _majorVersion ),
|
||||||
|
minorVersion( _minorVersion ),
|
||||||
|
patchNumber( _patchNumber ),
|
||||||
|
branchName( _branchName ),
|
||||||
|
buildNumber( _buildNumber )
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::ostream& operator << ( std::ostream& os, Version const& version ) {
|
||||||
|
os << version.majorVersion << "."
|
||||||
|
<< version.minorVersion << "."
|
||||||
|
<< version.patchNumber;
|
||||||
|
|
||||||
|
if( !version.branchName.empty() ) {
|
||||||
|
os << "-" << version.branchName
|
||||||
|
<< "." << version.buildNumber;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
Version libraryVersion( 1, 2, 1, "", 0 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// #included from: catch_message.hpp
|
// #included from: catch_message.hpp
|
||||||
|
@ -8733,12 +8694,7 @@ namespace Catch {
|
||||||
stream << "\n" << getLineOfChars<'~'>() << "\n";
|
stream << "\n" << getLineOfChars<'~'>() << "\n";
|
||||||
Colour colour( Colour::SecondaryText );
|
Colour colour( Colour::SecondaryText );
|
||||||
stream << currentTestRunInfo->name
|
stream << currentTestRunInfo->name
|
||||||
<< " is a Catch v" << libraryVersion.majorVersion << "."
|
<< " is a Catch v" << libraryVersion << " host application.\n"
|
||||||
<< libraryVersion.minorVersion << " b"
|
|
||||||
<< libraryVersion.buildNumber;
|
|
||||||
if( libraryVersion.branchName != std::string( "master" ) )
|
|
||||||
stream << " (" << libraryVersion.branchName << ")";
|
|
||||||
stream << " host application.\n"
|
|
||||||
<< "Run with -? for options\n\n";
|
<< "Run with -? for options\n\n";
|
||||||
|
|
||||||
if( m_config->rngSeed() != 0 )
|
if( m_config->rngSeed() != 0 )
|
||||||
|
|
Loading…
Reference in a new issue