Introduce conditional wchar_t (and std::wstring) support

The support is turned on by default but the user might need to be able
to turn it off which is now possible by defining CATCH_CONFIG_NO_WCHAR.
This commit is contained in:
Tomas Zeman authored and Martin Hořeňovský committed 2018-03-07 10:35:31 +01:00
1 parent 865d5f59b4
commit 352853ed7e
8 files changed
+22 -3

No files matched your search

+4
View File
@@ -116,6 +116,7 @@ std::string StringMaker<std::string>::convert(const std::string& str) {
return s;
}
#ifdef CATCH_CONFIG_WCHAR
std::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {
std::string s;
s.reserve(wstr.size());
@@ -124,6 +125,7 @@ std::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {
}
return ::Catch::Detail::stringify(s);
}
#endif
std::string StringMaker<char const*>::convert(char const* str) {
if (str) {
@@ -139,6 +141,7 @@ std::string StringMaker<char*>::convert(char* str) {
return{ "{null string}" };
}
}
#ifdef CATCH_CONFIG_WCHAR
std::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {
if (str) {
return ::Catch::Detail::stringify(std::wstring{ str });
@@ -153,6 +156,7 @@ std::string StringMaker<wchar_t *>::convert(wchar_t * str) {
return{ "{null string}" };
}
}
#endif
std::string StringMaker<int>::convert(int value) {