aboutsummaryrefslogtreecommitdiff
path: root/third_party/googletest/custom/gtest/internal/custom/gtest-printers.h
blob: 523dc1477c0f1db2ab0d750567d11656f7055156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2023 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
#define THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_

#include <string>

namespace fxcrt {
class ByteString;
}

namespace testing {

// If a C string is compared with a PDFium string object, then it is meant to
// point to a NUL-terminated string, and thus print it as a string.

#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
  template <>                                                            \
  class internal::FormatForComparison<CharType*, OtherStringType> {      \
   public:                                                               \
    static std::string Format(CharType* value) {                         \
      return ::testing::PrintToString(value);                            \
    }                                                                    \
  }

GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, fxcrt::ByteString);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, fxcrt::ByteString);

#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_

}  // namespace testing

#endif  // THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_