mirror of
https://github.com/catchorg/Catch2.git
synced 2025-02-17 03:43:29 +01:00
Minor clean-ups in string conversion code
This commit is contained in:
parent
b0e3f45a22
commit
cd6f6c021a
@ -35,6 +35,9 @@ namespace Catch {
|
|||||||
using ::operator<<;
|
using ::operator<<;
|
||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
|
|
||||||
|
extern const std::string unprintableString;
|
||||||
|
|
||||||
std::string rawMemoryToString( const void *object, std::size_t size );
|
std::string rawMemoryToString( const void *object, std::size_t size );
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -64,7 +67,7 @@ namespace Catch {
|
|||||||
static
|
static
|
||||||
typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
|
typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
|
||||||
convert(const Fake& t) {
|
convert(const Fake& t) {
|
||||||
std::stringstream sstr;
|
std::ostringstream sstr;
|
||||||
sstr << t;
|
sstr << t;
|
||||||
return sstr.str();
|
return sstr.str();
|
||||||
}
|
}
|
||||||
@ -73,14 +76,12 @@ namespace Catch {
|
|||||||
static
|
static
|
||||||
typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
|
typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
|
||||||
convert(const Fake&) {
|
convert(const Fake&) {
|
||||||
return "{?}";
|
return Detail::unprintableString;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
|
|
||||||
extern const std::string unprintableString;
|
|
||||||
|
|
||||||
// This function dispatches all stringification requests inside of Catch.
|
// This function dispatches all stringification requests inside of Catch.
|
||||||
// Should be preferably called fully qualified, like ::Catch::Detail::stringify
|
// Should be preferably called fully qualified, like ::Catch::Detail::stringify
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user