Outline catch_strnlen's definition into catch_tostring.cpp

This commit is contained in:
ZXShady
2025-10-04 22:10:36 +02:00
committed by Martin Hořeňovský
parent 363ca5af18
commit a9223b2bb3
2 changed files with 7 additions and 7 deletions
+6
View File
@@ -57,6 +57,12 @@ namespace Detail {
}
} // end unnamed namespace
std::size_t catch_strnlen( const char* str, std::size_t n ) {
auto ret = std::char_traits<char>::find( str, n, '\0' );
if ( ret != nullptr ) { return static_cast<std::size_t>( ret - str ); }
return n;
}
std::string convertIntoString(StringRef string, bool escapeInvisibles) {
std::string ret;
// This is enough for the "don't escape invisibles" case, and a good
+1 -7
View File
@@ -40,13 +40,7 @@ namespace Catch {
namespace Detail {
inline std::size_t catch_strnlen(const char *str, std::size_t n) {
auto ret = std::char_traits<char>::find(str, n, '\0');
if (ret != nullptr) {
return static_cast<std::size_t>(ret - str);
}
return n;
}
std::size_t catch_strnlen(const char *str, std::size_t n);
constexpr StringRef unprintableString = "{?}"_sr;