diff --git a/include/znc/ZNCString.h b/include/znc/ZNCString.h index 30bdcd8a..ae1a647b 100644 --- a/include/znc/ZNCString.h +++ b/include/znc/ZNCString.h @@ -697,4 +697,11 @@ class CInlineFormatMessage { CString m_sFormat; }; +// For gtest +#ifdef GTEST_FAIL +inline void PrintTo(const CString& s, std::ostream* os) { + *os << '"' << s.Escape_n(CString::EDEBUG) << '"'; +} +#endif + #endif // !ZNCSTRING_H diff --git a/test/StringTest.cpp b/test/StringTest.cpp index a675a3f7..0e99caef 100644 --- a/test/StringTest.cpp +++ b/test/StringTest.cpp @@ -17,11 +17,6 @@ #include #include -// GTest uses this function to output objects -static void PrintTo(const CString& s, std::ostream* o) { - *o << '"' << s.Escape_n(CString::EASCII, CString::EDEBUG) << '"'; -} - class EscapeTest : public ::testing::Test { protected: void testEncode(const CString& in, const CString& expectedOut,