From 6498a5112cf02cddeb0b300d9ad3620159c9931f Mon Sep 17 00:00:00 2001 From: Marco Nilsson Date: Wed, 19 Dec 2012 10:38:03 +0100 Subject: [PATCH] Only add wstring versions of toString if wchar_t has been defined. This fixes some issues on embedded platforms where wstring isn't available. --- include/internal/catch_tostring.hpp | 2 ++ single_include/catch.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index b6802af9..4d2be7b1 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -73,6 +73,7 @@ inline std::string toString( const std::string& value ) { return "\"" + value + "\""; } +#ifdef wchar_t inline std::string toString( const std::wstring& value ) { std::ostringstream oss; oss << "\""; @@ -81,6 +82,7 @@ inline std::string toString( const std::wstring& value ) { oss << "\""; return oss.str(); } +#endif inline std::string toString( const char* const value ) { return value ? Catch::toString( std::string( value ) ) : std::string( "{null string}" ); diff --git a/single_include/catch.hpp b/single_include/catch.hpp index cd5bd053..f5918910 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -545,6 +545,7 @@ inline std::string toString( const std::string& value ) { return "\"" + value + "\""; } +#ifdef wchar_t inline std::string toString( const std::wstring& value ) { std::ostringstream oss; oss << "\""; @@ -553,6 +554,7 @@ inline std::string toString( const std::wstring& value ) { oss << "\""; return oss.str(); } +#endif inline std::string toString( const char* const value ) { return value ? Catch::toString( std::string( value ) ) : std::string( "{null string}" );