mirror of
https://github.com/catchorg/Catch2.git
synced 2025-02-17 03:43:29 +01:00
dev build 5
This commit is contained in:
parent
927f520a97
commit
355ab78f4a
@ -4,7 +4,7 @@ from conans import ConanFile
|
|||||||
|
|
||||||
class CatchConan(ConanFile):
|
class CatchConan(ConanFile):
|
||||||
name = "Catch"
|
name = "Catch"
|
||||||
version = "2.0.0-develop.4"
|
version = "2.0.0-develop.5"
|
||||||
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
||||||
author = "philsquared"
|
author = "philsquared"
|
||||||
generators = "cmake"
|
generators = "cmake"
|
||||||
|
@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 0, 0, "develop", 4 );
|
static Version version( 2, 0, 0, "develop", 5 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v2.0.0-develop.4
|
* Catch v2.0.0-develop.5
|
||||||
* Generated: 2017-09-19 17:37:34.480115
|
* Generated: 2017-10-12 13:05:08.135067
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* 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) 2017 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@ -480,7 +480,6 @@ struct AutoReg : NonCopyable {
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <tuple>
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -749,7 +748,53 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// === Pair ===
|
template<typename T>
|
||||||
|
struct EnumStringMaker {
|
||||||
|
static std::string convert(const T& t) {
|
||||||
|
return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<T>::type>(t));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
|
template<>
|
||||||
|
struct StringMaker<NSString*> {
|
||||||
|
static std::string convert(NSString * nsstring) {
|
||||||
|
if (!nsstring)
|
||||||
|
return "nil";
|
||||||
|
return std::string("@") + [nsstring UTF8String];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template<>
|
||||||
|
struct StringMaker<NSObject*> {
|
||||||
|
static std::string convert(NSObject* nsObject) {
|
||||||
|
return ::Catch::Detail::stringify([nsObject description]);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
namespace Detail {
|
||||||
|
inline std::string stringify( NSString* nsstring ) {
|
||||||
|
return StringMaker<NSString*>::convert( nsstring );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Detail
|
||||||
|
#endif // __OBJC__
|
||||||
|
|
||||||
|
} // namespace Catch
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
// Separate std-lib types stringification, so it can be selectively enabled
|
||||||
|
// This means that we do not bring in
|
||||||
|
|
||||||
|
#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)
|
||||||
|
# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
|
||||||
|
# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
|
||||||
|
# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Separate std::pair specialization
|
||||||
|
#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)
|
||||||
|
#include <utility>
|
||||||
|
namespace Catch {
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
struct StringMaker<std::pair<T1, T2> > {
|
struct StringMaker<std::pair<T1, T2> > {
|
||||||
static std::string convert(const std::pair<T1, T2>& pair) {
|
static std::string convert(const std::pair<T1, T2>& pair) {
|
||||||
@ -762,7 +807,13 @@ namespace Catch {
|
|||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
|
||||||
|
|
||||||
|
// Separate std::tuple specialization
|
||||||
|
#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)
|
||||||
|
#include <tuple>
|
||||||
|
namespace Catch {
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
template<
|
template<
|
||||||
typename Tuple,
|
typename Tuple,
|
||||||
@ -797,39 +848,124 @@ namespace Catch {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct EnumStringMaker {
|
|
||||||
static std::string convert(const T& t) {
|
|
||||||
return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<T>::type>(t));
|
|
||||||
}
|
}
|
||||||
|
#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
|
||||||
|
|
||||||
|
// Separate std::chrono::duration specialization
|
||||||
|
#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
|
||||||
|
#include <ctime>
|
||||||
|
#include <ratio>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
template <class Ratio>
|
||||||
|
struct ratio_string {
|
||||||
|
static std::string symbol();
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __OBJC__
|
template <class Ratio>
|
||||||
template<>
|
std::string ratio_string<Ratio>::symbol() {
|
||||||
struct StringMaker<NSString*> {
|
std::ostringstream oss;
|
||||||
static std::string convert(NSString * nsstring) {
|
oss << '[' << Ratio::num << '/'
|
||||||
if (!nsstring)
|
<< Ratio::den << ']';
|
||||||
return "nil";
|
return oss.str();
|
||||||
return std::string("@") + [nsstring UTF8String];
|
|
||||||
}
|
}
|
||||||
|
template <>
|
||||||
|
struct ratio_string<std::atto> {
|
||||||
|
static std::string symbol() { return "a"; }
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct StringMaker<NSObject*> {
|
struct ratio_string<std::femto> {
|
||||||
static std::string convert(NSObject* nsObject) {
|
static std::string symbol() { return "f"; }
|
||||||
return ::Catch::Detail::stringify([nsObject description]);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
namespace Detail {
|
template <>
|
||||||
inline std::string stringify( NSString* nsstring ) {
|
struct ratio_string<std::pico> {
|
||||||
return StringMaker<NSString*>::convert( nsstring );
|
static std::string symbol() { return "p"; }
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ratio_string<std::nano> {
|
||||||
|
static std::string symbol() { return "n"; }
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ratio_string<std::micro> {
|
||||||
|
static std::string symbol() { return "u"; }
|
||||||
|
};
|
||||||
|
template <>
|
||||||
|
struct ratio_string<std::milli> {
|
||||||
|
static std::string symbol() { return "m"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
////////////
|
||||||
|
// std::chrono::duration specializations
|
||||||
|
template<typename Value, typename Ratio>
|
||||||
|
struct StringMaker<std::chrono::duration<Value, Ratio>> {
|
||||||
|
static std::string convert(std::chrono::duration<Value, Ratio> const& duration) {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';
|
||||||
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
template<typename Value>
|
||||||
|
struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {
|
||||||
|
static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << duration.count() << " s";
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template<typename Value>
|
||||||
|
struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {
|
||||||
|
static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << duration.count() << " m";
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
template<typename Value>
|
||||||
|
struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {
|
||||||
|
static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << duration.count() << " h";
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Detail
|
////////////
|
||||||
#endif // __OBJC__
|
// std::chrono::time_point specialization
|
||||||
|
// Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>
|
||||||
|
template<typename Clock, typename Duration>
|
||||||
|
struct StringMaker<std::chrono::time_point<Clock, Duration>> {
|
||||||
|
static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) {
|
||||||
|
return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// std::chrono::time_point<system_clock> specialization
|
||||||
|
template<typename Duration>
|
||||||
|
struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {
|
||||||
|
static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {
|
||||||
|
auto converted = std::chrono::system_clock::to_time_t(time_point);
|
||||||
|
|
||||||
} // namespace Catch
|
#ifdef _MSC_VER
|
||||||
|
std::tm timeInfo = {};
|
||||||
|
gmtime_s(&timeInfo, &converted);
|
||||||
|
#else
|
||||||
|
std::tm* timeInfo = std::gmtime(&converted);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
|
||||||
|
char timeStamp[timeStampSize];
|
||||||
|
const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
|
||||||
|
#else
|
||||||
|
std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
|
||||||
|
#endif
|
||||||
|
return std::string(timeStamp);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
@ -1614,6 +1750,7 @@ namespace Catch {
|
|||||||
static std::string translatorName( signature )
|
static std::string translatorName( signature )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -1646,7 +1783,7 @@ namespace Catch {
|
|||||||
std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
|
std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
|
||||||
try {
|
try {
|
||||||
if( it == itEnd )
|
if( it == itEnd )
|
||||||
throw;
|
std::rethrow_exception(std::current_exception());
|
||||||
else
|
else
|
||||||
return (*it)->translate( it+1, itEnd );
|
return (*it)->translate( it+1, itEnd );
|
||||||
}
|
}
|
||||||
@ -4205,6 +4342,10 @@ namespace Catch {
|
|||||||
#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80
|
#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
|
||||||
|
#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------- #included from clara_textflow.hpp -----------
|
// ----------- #included from clara_textflow.hpp -----------
|
||||||
|
|
||||||
// TextFlowCpp
|
// TextFlowCpp
|
||||||
@ -4538,9 +4679,8 @@ namespace Catch { namespace clara { namespace TextFlow {
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if !defined(CLARA_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )
|
#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )
|
||||||
#define CLARA_PLATFORM_WINDOWS
|
#define CATCH_PLATFORM_WINDOWS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Catch { namespace clara {
|
namespace Catch { namespace clara {
|
||||||
@ -4736,25 +4876,19 @@ namespace detail {
|
|||||||
template<typename U>
|
template<typename U>
|
||||||
explicit BasicResult( BasicResult<U> const &other )
|
explicit BasicResult( BasicResult<U> const &other )
|
||||||
: ResultValueBase<T>( other.type() ),
|
: ResultValueBase<T>( other.type() ),
|
||||||
m_errorMessage(other.errorMessage()) {
|
m_errorMessage( other.errorMessage() )
|
||||||
|
{
|
||||||
assert( type() != ResultBase::Ok );
|
assert( type() != ResultBase::Ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto ok() -> BasicResult { return {ResultBase::Ok}; }
|
|
||||||
|
|
||||||
template<typename U>
|
template<typename U>
|
||||||
static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }
|
static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }
|
||||||
|
static auto ok() -> BasicResult { return { ResultBase::Ok }; }
|
||||||
static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }
|
static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }
|
||||||
|
static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }
|
||||||
static auto runtimeError(std::string const &message) -> BasicResult {
|
|
||||||
return {ResultBase::RuntimeError, message};
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit operator bool() const { return m_type == ResultBase::Ok; }
|
explicit operator bool() const { return m_type == ResultBase::Ok; }
|
||||||
|
|
||||||
auto type() const -> ResultBase::Type { return m_type; }
|
auto type() const -> ResultBase::Type { return m_type; }
|
||||||
|
|
||||||
auto errorMessage() const -> std::string { return m_errorMessage; }
|
auto errorMessage() const -> std::string { return m_errorMessage; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -4774,7 +4908,8 @@ namespace detail {
|
|||||||
|
|
||||||
BasicResult( ResultBase::Type type, std::string const &message )
|
BasicResult( ResultBase::Type type, std::string const &message )
|
||||||
: ResultValueBase<T>(type),
|
: ResultValueBase<T>(type),
|
||||||
m_errorMessage(message) {
|
m_errorMessage(message)
|
||||||
|
{
|
||||||
assert( m_type != ResultBase::Ok );
|
assert( m_type != ResultBase::Ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4791,10 +4926,10 @@ namespace detail {
|
|||||||
|
|
||||||
ParseState( ParseResultType type, TokenStream const &remainingTokens )
|
ParseState( ParseResultType type, TokenStream const &remainingTokens )
|
||||||
: m_type(type),
|
: m_type(type),
|
||||||
m_remainingTokens(remainingTokens) {}
|
m_remainingTokens( remainingTokens )
|
||||||
|
{}
|
||||||
|
|
||||||
auto type() const -> ParseResultType { return m_type; }
|
auto type() const -> ParseResultType { return m_type; }
|
||||||
|
|
||||||
auto remainingTokens() const -> TokenStream { return m_remainingTokens; }
|
auto remainingTokens() const -> TokenStream { return m_remainingTokens; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -4839,23 +4974,16 @@ namespace detail {
|
|||||||
|
|
||||||
struct BoundRefBase {
|
struct BoundRefBase {
|
||||||
BoundRefBase() = default;
|
BoundRefBase() = default;
|
||||||
|
|
||||||
BoundRefBase( BoundRefBase const & ) = delete;
|
BoundRefBase( BoundRefBase const & ) = delete;
|
||||||
|
|
||||||
BoundRefBase( BoundRefBase && ) = delete;
|
BoundRefBase( BoundRefBase && ) = delete;
|
||||||
|
|
||||||
BoundRefBase &operator=( BoundRefBase const & ) = delete;
|
BoundRefBase &operator=( BoundRefBase const & ) = delete;
|
||||||
|
|
||||||
BoundRefBase &operator=( BoundRefBase && ) = delete;
|
BoundRefBase &operator=( BoundRefBase && ) = delete;
|
||||||
|
|
||||||
virtual ~BoundRefBase() = default;
|
virtual ~BoundRefBase() = default;
|
||||||
|
|
||||||
virtual auto isFlag() const -> bool = 0;
|
virtual auto isFlag() const -> bool = 0;
|
||||||
|
|
||||||
virtual auto isContainer() const -> bool { return false; }
|
virtual auto isContainer() const -> bool { return false; }
|
||||||
|
|
||||||
virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
|
virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
|
||||||
|
|
||||||
virtual auto setFlag( bool flag ) -> ParserResult = 0;
|
virtual auto setFlag( bool flag ) -> ParserResult = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4972,9 +5100,7 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Optionality {
|
enum class Optionality { Optional, Required };
|
||||||
Optional, Required
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Parser;
|
struct Parser;
|
||||||
|
|
||||||
@ -4994,7 +5120,7 @@ namespace detail {
|
|||||||
class ComposableParserImpl : public ParserBase {
|
class ComposableParserImpl : public ParserBase {
|
||||||
public:
|
public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto operator+(T const &other) const -> Parser;
|
auto operator|( T const &other ) const -> Parser;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Common code and state for Args and Opts
|
// Common code and state for Args and Opts
|
||||||
@ -5010,11 +5136,16 @@ namespace detail {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ParserRefImpl(T &ref, std::string const &hint) : m_ref(std::make_shared<BoundRef<T>>(ref)), m_hint(hint) {}
|
ParserRefImpl( T &ref, std::string const &hint )
|
||||||
|
: m_ref( std::make_shared<BoundRef<T>>( ref ) ),
|
||||||
|
m_hint( hint )
|
||||||
|
{}
|
||||||
|
|
||||||
template<typename LambdaT>
|
template<typename LambdaT>
|
||||||
ParserRefImpl(LambdaT const &ref, std::string const &hint) : m_ref(std::make_shared<BoundLambda<LambdaT>>(ref)),
|
ParserRefImpl( LambdaT const &ref, std::string const &hint )
|
||||||
m_hint(hint) {}
|
: m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),
|
||||||
|
m_hint(hint)
|
||||||
|
{}
|
||||||
|
|
||||||
auto operator()( std::string const &description ) -> DerivedT & {
|
auto operator()( std::string const &description ) -> DerivedT & {
|
||||||
m_description = description;
|
m_description = description;
|
||||||
@ -5153,7 +5284,7 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto isMatch( std::string const &optToken ) const -> bool {
|
auto isMatch( std::string const &optToken ) const -> bool {
|
||||||
#ifdef CLARA_PLATFORM_WINDOWS
|
#ifdef CATCH_PLATFORM_WINDOWS
|
||||||
auto normalisedToken = normaliseOpt( optToken );
|
auto normalisedToken = normaliseOpt( optToken );
|
||||||
#else
|
#else
|
||||||
auto const &normalisedToken = optToken;
|
auto const &normalisedToken = optToken;
|
||||||
@ -5234,30 +5365,30 @@ namespace detail {
|
|||||||
std::vector<Opt> m_options;
|
std::vector<Opt> m_options;
|
||||||
std::vector<Arg> m_args;
|
std::vector<Arg> m_args;
|
||||||
|
|
||||||
auto operator+=(ExeName const &exeName) -> Parser & {
|
auto operator|=( ExeName const &exeName ) -> Parser & {
|
||||||
m_exeName = exeName;
|
m_exeName = exeName;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto operator+=(Arg const &arg) -> Parser & {
|
auto operator|=( Arg const &arg ) -> Parser & {
|
||||||
m_args.push_back(arg);
|
m_args.push_back(arg);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto operator+=(Opt const &opt) -> Parser & {
|
auto operator|=( Opt const &opt ) -> Parser & {
|
||||||
m_options.push_back(opt);
|
m_options.push_back(opt);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto operator+=(Parser const &other) -> Parser & {
|
auto operator|=( Parser const &other ) -> Parser & {
|
||||||
m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());
|
m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());
|
||||||
m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());
|
m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto operator+(T const &other) const -> Parser {
|
auto operator|( T const &other ) const -> Parser {
|
||||||
return Parser(*this) += other;
|
return Parser( *this ) |= other;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getHelpColumns() const -> std::vector<HelpColumns> {
|
auto getHelpColumns() const -> std::vector<HelpColumns> {
|
||||||
@ -5330,46 +5461,46 @@ namespace detail {
|
|||||||
using ParserBase::parse;
|
using ParserBase::parse;
|
||||||
|
|
||||||
auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {
|
auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {
|
||||||
std::vector<ParserBase const *> allParsers;
|
|
||||||
allParsers.reserve(m_args.size() + m_options.size());
|
|
||||||
std::set<ParserBase const *> requiredParsers;
|
|
||||||
|
|
||||||
for (auto const &opt : m_options) {
|
struct ParserInfo {
|
||||||
allParsers.push_back(&opt);
|
ParserBase const* parser = nullptr;
|
||||||
if (!opt.isOptional())
|
size_t count = 0;
|
||||||
requiredParsers.insert(&opt);
|
};
|
||||||
}
|
const size_t totalParsers = m_options.size() + m_args.size();
|
||||||
|
assert( totalParsers < 512 );
|
||||||
|
// ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do
|
||||||
|
ParserInfo parseInfos[512];
|
||||||
|
|
||||||
size_t optionalArgs = 0;
|
{
|
||||||
for (auto const &arg : m_args) {
|
size_t i = 0;
|
||||||
allParsers.push_back(&arg);
|
for (auto const &opt : m_options) parseInfos[i++].parser = &opt;
|
||||||
if (!arg.isOptional()) {
|
for (auto const &arg : m_args) parseInfos[i++].parser = &arg;
|
||||||
if (optionalArgs > 0)
|
|
||||||
return InternalParseResult::logicError(
|
|
||||||
"Required arguments must preceed any optional arguments");
|
|
||||||
else
|
|
||||||
++optionalArgs;
|
|
||||||
requiredParsers.insert(&arg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_exeName.set( exeName );
|
m_exeName.set( exeName );
|
||||||
|
|
||||||
auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
|
auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
|
||||||
while( result.value().remainingTokens() ) {
|
while( result.value().remainingTokens() ) {
|
||||||
auto remainingTokenCount = result.value().remainingTokens().count();
|
bool tokenParsed = false;
|
||||||
for (auto parser : allParsers) {
|
|
||||||
result = parser->parse( exeName, result.value().remainingTokens() );
|
for( size_t i = 0; i < totalParsers; ++i ) {
|
||||||
if (!result || result.value().type() != ParseResultType::NoMatch) {
|
auto& parseInfo = parseInfos[i];
|
||||||
if (parser->cardinality() == 1)
|
if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {
|
||||||
allParsers.erase(std::remove(allParsers.begin(), allParsers.end(), parser),
|
result = parseInfo.parser->parse(exeName, result.value().remainingTokens());
|
||||||
allParsers.end());
|
if (!result)
|
||||||
requiredParsers.erase(parser);
|
return result;
|
||||||
|
if (result.value().type() != ParseResultType::NoMatch) {
|
||||||
|
tokenParsed = true;
|
||||||
|
++parseInfo.count;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!result || remainingTokenCount == result.value().remainingTokens().count())
|
}
|
||||||
|
|
||||||
|
if( result.value().type() == ParseResultType::ShortCircuitAll )
|
||||||
return result;
|
return result;
|
||||||
|
if( !tokenParsed )
|
||||||
|
return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token );
|
||||||
}
|
}
|
||||||
// !TBD Check missing required options
|
// !TBD Check missing required options
|
||||||
return result;
|
return result;
|
||||||
@ -5378,8 +5509,8 @@ namespace detail {
|
|||||||
|
|
||||||
template<typename DerivedT>
|
template<typename DerivedT>
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto ComposableParserImpl<DerivedT>::operator+(T const &other) const -> Parser {
|
auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {
|
||||||
return Parser() + static_cast<DerivedT const &>( *this ) + other;
|
return Parser() | static_cast<DerivedT const &>( *this ) | other;
|
||||||
}
|
}
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
@ -5516,84 +5647,84 @@ namespace Catch {
|
|||||||
|
|
||||||
auto cli
|
auto cli
|
||||||
= ExeName( config.processName )
|
= ExeName( config.processName )
|
||||||
+ Help( config.showHelp )
|
| Help( config.showHelp )
|
||||||
+ Opt( config.listTests )
|
| Opt( config.listTests )
|
||||||
["-l"]["--list-tests"]
|
["-l"]["--list-tests"]
|
||||||
( "list all/matching test cases" )
|
( "list all/matching test cases" )
|
||||||
+ Opt( config.listTags )
|
| Opt( config.listTags )
|
||||||
["-t"]["--list-tags"]
|
["-t"]["--list-tags"]
|
||||||
( "list all/matching tags" )
|
( "list all/matching tags" )
|
||||||
+ Opt( config.showSuccessfulTests )
|
| Opt( config.showSuccessfulTests )
|
||||||
["-s"]["--success"]
|
["-s"]["--success"]
|
||||||
( "include successful tests in output" )
|
( "include successful tests in output" )
|
||||||
+ Opt( config.shouldDebugBreak )
|
| Opt( config.shouldDebugBreak )
|
||||||
["-b"]["--break"]
|
["-b"]["--break"]
|
||||||
( "break into debugger on failure" )
|
( "break into debugger on failure" )
|
||||||
+ Opt( config.noThrow )
|
| Opt( config.noThrow )
|
||||||
["-e"]["--nothrow"]
|
["-e"]["--nothrow"]
|
||||||
( "skip exception tests" )
|
( "skip exception tests" )
|
||||||
+ Opt( config.showInvisibles )
|
| Opt( config.showInvisibles )
|
||||||
["-i"]["--invisibles"]
|
["-i"]["--invisibles"]
|
||||||
( "show invisibles (tabs, newlines)" )
|
( "show invisibles (tabs, newlines)" )
|
||||||
+ Opt( config.outputFilename, "filename" )
|
| Opt( config.outputFilename, "filename" )
|
||||||
["-o"]["--out"]
|
["-o"]["--out"]
|
||||||
( "output filename" )
|
( "output filename" )
|
||||||
+ Opt( config.reporterNames, "name" )
|
| Opt( config.reporterNames, "name" )
|
||||||
["-r"]["--reporter"]
|
["-r"]["--reporter"]
|
||||||
( "reporter to use (defaults to console)" )
|
( "reporter to use (defaults to console)" )
|
||||||
+ Opt( config.name, "name" )
|
| Opt( config.name, "name" )
|
||||||
["-n"]["--name"]
|
["-n"]["--name"]
|
||||||
( "suite name" )
|
( "suite name" )
|
||||||
+ Opt( [&]( bool ){ config.abortAfter = 1; } )
|
| Opt( [&]( bool ){ config.abortAfter = 1; } )
|
||||||
["-a"]["--abort"]
|
["-a"]["--abort"]
|
||||||
( "abort at first failure" )
|
( "abort at first failure" )
|
||||||
+ Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
|
| Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
|
||||||
["-x"]["--abortx"]
|
["-x"]["--abortx"]
|
||||||
( "abort after x failures" )
|
( "abort after x failures" )
|
||||||
+ Opt( setWarning, "warning name" )
|
| Opt( setWarning, "warning name" )
|
||||||
["-w"]["--warn"]
|
["-w"]["--warn"]
|
||||||
( "enable warnings" )
|
( "enable warnings" )
|
||||||
+ Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
|
| Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
|
||||||
["-d"]["--durations"]
|
["-d"]["--durations"]
|
||||||
( "show test durations" )
|
( "show test durations" )
|
||||||
+ Opt( loadTestNamesFromFile, "filename" )
|
| Opt( loadTestNamesFromFile, "filename" )
|
||||||
["-f"]["--input-file"]
|
["-f"]["--input-file"]
|
||||||
( "load test names to run from a file" )
|
( "load test names to run from a file" )
|
||||||
+ Opt( config.filenamesAsTags )
|
| Opt( config.filenamesAsTags )
|
||||||
["-#"]["--filenames-as-tags"]
|
["-#"]["--filenames-as-tags"]
|
||||||
( "adds a tag for the filename" )
|
( "adds a tag for the filename" )
|
||||||
+ Opt( config.sectionsToRun, "section name" )
|
| Opt( config.sectionsToRun, "section name" )
|
||||||
["-c"]["--section"]
|
["-c"]["--section"]
|
||||||
( "specify section to run" )
|
( "specify section to run" )
|
||||||
+ Opt( setVerbosity, "quiet|normal|high" )
|
| Opt( setVerbosity, "quiet|normal|high" )
|
||||||
["-v"]["--verbosity"]
|
["-v"]["--verbosity"]
|
||||||
( "set output verbosity" )
|
( "set output verbosity" )
|
||||||
+ Opt( config.listTestNamesOnly )
|
| Opt( config.listTestNamesOnly )
|
||||||
["--list-test-names-only"]
|
["--list-test-names-only"]
|
||||||
( "list all/matching test cases names only" )
|
( "list all/matching test cases names only" )
|
||||||
+ Opt( config.listReporters )
|
| Opt( config.listReporters )
|
||||||
["--list-reporters"]
|
["--list-reporters"]
|
||||||
( "list all reporters" )
|
( "list all reporters" )
|
||||||
+ Opt( setTestOrder, "decl|lex|rand" )
|
| Opt( setTestOrder, "decl|lex|rand" )
|
||||||
["--order"]
|
["--order"]
|
||||||
( "test case order (defaults to decl)" )
|
( "test case order (defaults to decl)" )
|
||||||
+ Opt( setRngSeed, "'time'|number" )
|
| Opt( setRngSeed, "'time'|number" )
|
||||||
["--rng-seed"]
|
["--rng-seed"]
|
||||||
( "set a specific seed for random numbers" )
|
( "set a specific seed for random numbers" )
|
||||||
+ Opt( setColourUsage, "yes|no" )
|
| Opt( setColourUsage, "yes|no" )
|
||||||
["--use-colour"]
|
["--use-colour"]
|
||||||
( "should output be colourised" )
|
( "should output be colourised" )
|
||||||
+ Opt( config.libIdentify )
|
| Opt( config.libIdentify )
|
||||||
["--libidentify"]
|
["--libidentify"]
|
||||||
( "report name and version according to libidentify standard" )
|
( "report name and version according to libidentify standard" )
|
||||||
+ Opt( setWaitForKeypress, "start|exit|both" )
|
| Opt( setWaitForKeypress, "start|exit|both" )
|
||||||
["--wait-for-keypress"]
|
["--wait-for-keypress"]
|
||||||
( "waits for a keypress before exiting" )
|
( "waits for a keypress before exiting" )
|
||||||
+ Opt( config.benchmarkResolutionMultiple, "multiplier" )
|
| Opt( config.benchmarkResolutionMultiple, "multiplier" )
|
||||||
["--benchmark-resolution-multiple"]
|
["--benchmark-resolution-multiple"]
|
||||||
( "multiple of clock resolution to run benchmarks" )
|
( "multiple of clock resolution to run benchmarks" )
|
||||||
|
|
||||||
+ Arg( config.testsOrTags, "test name|pattern|tags" )
|
| Arg( config.testsOrTags, "test name|pattern|tags" )
|
||||||
( "which test or tests to use" );
|
( "which test or tests to use" );
|
||||||
|
|
||||||
return cli;
|
return cli;
|
||||||
@ -5731,6 +5862,36 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// end catch_errno_guard.h
|
// end catch_errno_guard.h
|
||||||
|
// start catch_windows_h_proxy.h
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CATCH_PLATFORM_WINDOWS)
|
||||||
|
|
||||||
|
#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)
|
||||||
|
# define CATCH_DEFINED_NOMINMAX
|
||||||
|
# define NOMINMAX
|
||||||
|
#endif
|
||||||
|
#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)
|
||||||
|
# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __AFXDLL
|
||||||
|
#include <AfxWin.h>
|
||||||
|
#else
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CATCH_DEFINED_NOMINMAX
|
||||||
|
# undef NOMINMAX
|
||||||
|
#endif
|
||||||
|
#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN
|
||||||
|
# undef WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // defined(CATCH_PLATFORM_WINDOWS)
|
||||||
|
|
||||||
|
// end catch_windows_h_proxy.h
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -5761,34 +5922,6 @@ namespace Catch {
|
|||||||
|
|
||||||
#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////
|
#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////
|
||||||
|
|
||||||
// start catch_windows_h_proxy.h
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(CATCH_PLATFORM_WINDOWS)
|
|
||||||
# if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)
|
|
||||||
# define CATCH_DEFINED_NOMINMAX
|
|
||||||
# define NOMINMAX
|
|
||||||
# endif
|
|
||||||
# if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)
|
|
||||||
# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __AFXDLL
|
|
||||||
#include <AfxWin.h>
|
|
||||||
#else
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CATCH_DEFINED_NOMINMAX
|
|
||||||
# undef NOMINMAX
|
|
||||||
#endif
|
|
||||||
#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN
|
|
||||||
# undef WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// end catch_windows_h_proxy.h
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -6220,7 +6353,7 @@ namespace Catch {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
catch( TestFailureException& ) {
|
catch( TestFailureException& ) {
|
||||||
throw;
|
std::rethrow_exception(std::current_exception());
|
||||||
}
|
}
|
||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
return ex.what();
|
return ex.what();
|
||||||
@ -6238,7 +6371,7 @@ namespace Catch {
|
|||||||
|
|
||||||
std::string ExceptionTranslatorRegistry::tryTranslators() const {
|
std::string ExceptionTranslatorRegistry::tryTranslators() const {
|
||||||
if( m_translators.empty() )
|
if( m_translators.empty() )
|
||||||
throw;
|
std::rethrow_exception(std::current_exception());
|
||||||
else
|
else
|
||||||
return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
|
return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
|
||||||
}
|
}
|
||||||
@ -6523,6 +6656,9 @@ namespace Catch {
|
|||||||
|
|
||||||
static std::set<Verbosity> getSupportedVerbosities();
|
static std::set<Verbosity> getSupportedVerbosities();
|
||||||
|
|
||||||
|
void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
|
||||||
|
void benchmarkEnded( BenchmarkStats const& benchmarkStats ) override;
|
||||||
|
|
||||||
void testRunStarting( TestRunInfo const& testRunInfo ) override;
|
void testRunStarting( TestRunInfo const& testRunInfo ) override;
|
||||||
void testGroupStarting( GroupInfo const& groupInfo ) override;
|
void testGroupStarting( GroupInfo const& groupInfo ) override;
|
||||||
void testCaseStarting( TestCaseInfo const& testInfo ) override;
|
void testCaseStarting( TestCaseInfo const& testInfo ) override;
|
||||||
@ -9649,7 +9785,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 0, 0, "develop", 4 );
|
static Version version( 2, 0, 0, "develop", 5 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11204,6 +11340,15 @@ namespace Catch {
|
|||||||
reporter->noMatchingTestCases( spec );
|
reporter->noMatchingTestCases( spec );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MultipleReporters::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
|
||||||
|
for( auto const& reporter : m_reporters )
|
||||||
|
reporter->benchmarkStarting( benchmarkInfo );
|
||||||
|
}
|
||||||
|
void MultipleReporters::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {
|
||||||
|
for( auto const& reporter : m_reporters )
|
||||||
|
reporter->benchmarkEnded( benchmarkStats );
|
||||||
|
}
|
||||||
|
|
||||||
void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {
|
void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {
|
||||||
for( auto const& reporter : m_reporters )
|
for( auto const& reporter : m_reporters )
|
||||||
reporter->testRunStarting( testRunInfo );
|
reporter->testRunStarting( testRunInfo );
|
||||||
|
@ -10,7 +10,7 @@ class CatchConanTest(ConanFile):
|
|||||||
settings = "os", "compiler", "arch", "build_type"
|
settings = "os", "compiler", "arch", "build_type"
|
||||||
username = getenv("CONAN_USERNAME", "philsquared")
|
username = getenv("CONAN_USERNAME", "philsquared")
|
||||||
channel = getenv("CONAN_CHANNEL", "testing")
|
channel = getenv("CONAN_CHANNEL", "testing")
|
||||||
requires = "Catch/2.0.0-develop.4@%s/%s" % (username, channel)
|
requires = "Catch/2.0.0-develop.5@%s/%s" % (username, channel)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
cmake = CMake(self)
|
cmake = CMake(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user