1 // Copyright 2023 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 6 #define THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 7 8 #include <string> 9 10 namespace fxcrt { 11 class ByteString; 12 } 13 14 namespace testing { 15 16 // If a C string is compared with a PDFium string object, then it is meant to 17 // point to a NUL-terminated string, and thus print it as a string. 18 19 #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \ 20 template <> \ 21 class internal::FormatForComparison<CharType*, OtherStringType> { \ 22 public: \ 23 static std::string Format(CharType* value) { \ 24 return ::testing::PrintToString(value); \ 25 } \ 26 } 27 28 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, fxcrt::ByteString); 29 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, fxcrt::ByteString); 30 31 #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ 32 33 } // namespace testing 34 35 #endif // THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 36