mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-20 11:35:39 +02:00

committed by
Martin Hořeňovský

parent
1eb42eed97
commit
a575536abe
@@ -116,14 +116,9 @@ 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());
|
||||
for (auto c : wstr) {
|
||||
s += (c <= 0xff) ? static_cast<char>(c) : '?';
|
||||
}
|
||||
return ::Catch::Detail::stringify(s);
|
||||
#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
|
||||
std::string StringMaker<std::string_view>::convert(std::string_view str) {
|
||||
return ::Catch::Detail::stringify(std::string{ str });
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -141,7 +136,23 @@ std::string StringMaker<char*>::convert(char* str) {
|
||||
return{ "{null string}" };
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CATCH_CONFIG_WCHAR
|
||||
std::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {
|
||||
std::string s;
|
||||
s.reserve(wstr.size());
|
||||
for (auto c : wstr) {
|
||||
s += (c <= 0xff) ? static_cast<char>(c) : '?';
|
||||
}
|
||||
return ::Catch::Detail::stringify(s);
|
||||
}
|
||||
|
||||
# ifdef CATCH_CONFIG_CPP17_STRING_VIEW
|
||||
std::string StringMaker<std::wstring_view>::convert(std::wstring_view str) {
|
||||
return StringMaker<std::wstring>::convert(std::wstring(str));
|
||||
}
|
||||
# endif
|
||||
|
||||
std::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {
|
||||
if (str) {
|
||||
return ::Catch::Detail::stringify(std::wstring{ str });
|
||||
|
Reference in New Issue
Block a user