From 1e08e5c702935bede7ccda2115739b6b1eaad4dc Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Mon, 2 Apr 2018 12:16:36 +0100 Subject: [PATCH] Move gtest's printer for CString to a place visible to all tests --- include/znc/ZNCString.h | 7 +++++++ test/StringTest.cpp | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) 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,