mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Factored out mention of "unprintable string" ("{?}")
This commit is contained in:
parent
3e1d3c7271
commit
ea33961b43
@ -134,7 +134,7 @@
|
|||||||
std::string matcherAsString = ::Catch::Matchers::matcher.toString(); \
|
std::string matcherAsString = ::Catch::Matchers::matcher.toString(); \
|
||||||
__catchResult \
|
__catchResult \
|
||||||
.setLhs( Catch::toString( arg ) ) \
|
.setLhs( Catch::toString( arg ) ) \
|
||||||
.setRhs( matcherAsString == "{?}" ? #matcher : matcherAsString ) \
|
.setRhs( matcherAsString == Catch::Detail::unprintableString ? #matcher : matcherAsString ) \
|
||||||
.setOp( "matches" ) \
|
.setOp( "matches" ) \
|
||||||
.setResultType( ::Catch::Matchers::matcher.match( arg ) ); \
|
.setResultType( ::Catch::Matchers::matcher.match( arg ) ); \
|
||||||
__catchResult.captureExpression(); \
|
__catchResult.captureExpression(); \
|
||||||
|
@ -29,6 +29,8 @@ std::string toString( T const& value );
|
|||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
|
|
||||||
|
extern std::string unprintableString;
|
||||||
|
|
||||||
// SFINAE is currently disabled by default for all compilers.
|
// SFINAE is currently disabled by default for all compilers.
|
||||||
// If the non SFINAE version of IsStreamInsertable is ambiguous for you
|
// If the non SFINAE version of IsStreamInsertable is ambiguous for you
|
||||||
// and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE
|
// and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE
|
||||||
@ -71,11 +73,11 @@ namespace Detail {
|
|||||||
|
|
||||||
#if defined(CATCH_CPP11_OR_GREATER)
|
#if defined(CATCH_CPP11_OR_GREATER)
|
||||||
template<typename T,
|
template<typename T,
|
||||||
bool IsEmum = std::is_enum<T>::value
|
bool IsEnum = std::is_enum<T>::value
|
||||||
>
|
>
|
||||||
struct EnumStringMaker
|
struct EnumStringMaker
|
||||||
{
|
{
|
||||||
static std::string convert( T const& ) { return "{?}"; }
|
static std::string convert( T const& ) { return unprintableString; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -99,7 +101,7 @@ namespace Detail {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static std::string convert( T const& ) { return "{?}"; }
|
static std::string convert( T const& ) { return unprintableString; }
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -152,12 +154,17 @@ namespace Detail {
|
|||||||
std::string rangeToString( InputIterator first, InputIterator last );
|
std::string rangeToString( InputIterator first, InputIterator last );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//template<typename T, typename Allocator>
|
||||||
|
//struct StringMaker<std::vector<T, Allocator> > {
|
||||||
|
// static std::string convert( std::vector<T,Allocator> const& v ) {
|
||||||
|
// return Detail::rangeToString( v.begin(), v.end() );
|
||||||
|
// }
|
||||||
|
//};
|
||||||
|
|
||||||
template<typename T, typename Allocator>
|
template<typename T, typename Allocator>
|
||||||
struct StringMaker<std::vector<T, Allocator> > {
|
std::string toString( std::vector<T,Allocator> const& v ) {
|
||||||
static std::string convert( std::vector<T,Allocator> const& v ) {
|
|
||||||
return Detail::rangeToString( v.begin(), v.end() );
|
return Detail::rangeToString( v.begin(), v.end() );
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -15,6 +15,8 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
|
|
||||||
|
std::string unprintableString = "{?}";
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct Endianness {
|
struct Endianness {
|
||||||
enum Arch { Big, Little };
|
enum Arch { Big, Little };
|
||||||
|
Loading…
Reference in New Issue
Block a user