mirror of
https://github.com/google/googletest.git
synced 2024-12-27 02:01:25 +08:00
Use absl::HasAbslStringify
, instead of the internal version.
PiperOrigin-RevId: 567349341 Change-Id: I35f2679901aecbe9cb90d2e78ff28c5e383e7257
This commit is contained in:
parent
167a2255ae
commit
80306a7b5e
@ -59,7 +59,7 @@
|
|||||||
#ifdef GTEST_HAS_ABSL
|
#ifdef GTEST_HAS_ABSL
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "absl/strings/internal/has_absl_stringify.h"
|
#include "absl/strings/has_absl_stringify.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
#endif // GTEST_HAS_ABSL
|
#endif // GTEST_HAS_ABSL
|
||||||
|
|
||||||
@ -121,14 +121,14 @@ class GTEST_API_ Message {
|
|||||||
// Streams a non-pointer value to this object. If building a version of
|
// Streams a non-pointer value to this object. If building a version of
|
||||||
// GoogleTest with ABSL, this overload is only enabled if the value does not
|
// GoogleTest with ABSL, this overload is only enabled if the value does not
|
||||||
// have an AbslStringify definition.
|
// have an AbslStringify definition.
|
||||||
template <typename T
|
template <
|
||||||
|
typename T
|
||||||
#ifdef GTEST_HAS_ABSL
|
#ifdef GTEST_HAS_ABSL
|
||||||
,
|
,
|
||||||
typename std::enable_if<
|
typename std::enable_if<!absl::HasAbslStringify<T>::value, // NOLINT
|
||||||
!absl::strings_internal::HasAbslStringify<T>::value, // NOLINT
|
int>::type = 0
|
||||||
int>::type = 0
|
|
||||||
#endif // GTEST_HAS_ABSL
|
#endif // GTEST_HAS_ABSL
|
||||||
>
|
>
|
||||||
inline Message& operator<<(const T& val) {
|
inline Message& operator<<(const T& val) {
|
||||||
// Some libraries overload << for STL containers. These
|
// Some libraries overload << for STL containers. These
|
||||||
// overloads are defined in the global namespace instead of ::std.
|
// overloads are defined in the global namespace instead of ::std.
|
||||||
@ -153,9 +153,8 @@ class GTEST_API_ Message {
|
|||||||
// Streams a non-pointer value with an AbslStringify definition to this
|
// Streams a non-pointer value with an AbslStringify definition to this
|
||||||
// object.
|
// object.
|
||||||
template <typename T,
|
template <typename T,
|
||||||
typename std::enable_if<
|
typename std::enable_if<absl::HasAbslStringify<T>::value, // NOLINT
|
||||||
absl::strings_internal::HasAbslStringify<T>::value, // NOLINT
|
int>::type = 0>
|
||||||
int>::type = 0>
|
|
||||||
inline Message& operator<<(const T& val) {
|
inline Message& operator<<(const T& val) {
|
||||||
// ::operator<< is needed here for a similar reason as with the non-Abseil
|
// ::operator<< is needed here for a similar reason as with the non-Abseil
|
||||||
// version above
|
// version above
|
||||||
|
@ -116,7 +116,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef GTEST_HAS_ABSL
|
#ifdef GTEST_HAS_ABSL
|
||||||
#include "absl/strings/internal/has_absl_stringify.h"
|
#include "absl/strings/has_absl_stringify.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
#endif // GTEST_HAS_ABSL
|
#endif // GTEST_HAS_ABSL
|
||||||
#include "gtest/internal/gtest-internal.h"
|
#include "gtest/internal/gtest-internal.h"
|
||||||
@ -292,10 +292,9 @@ struct ConvertibleToStringViewPrinter {
|
|||||||
|
|
||||||
#ifdef GTEST_HAS_ABSL
|
#ifdef GTEST_HAS_ABSL
|
||||||
struct ConvertibleToAbslStringifyPrinter {
|
struct ConvertibleToAbslStringifyPrinter {
|
||||||
template <
|
template <typename T,
|
||||||
typename T,
|
typename = typename std::enable_if<
|
||||||
typename = typename std::enable_if<
|
absl::HasAbslStringify<T>::value>::type> // NOLINT
|
||||||
absl::strings_internal::HasAbslStringify<T>::value>::type> // NOLINT
|
|
||||||
static void PrintValue(const T& value, ::std::ostream* os) {
|
static void PrintValue(const T& value, ::std::ostream* os) {
|
||||||
*os << absl::StrCat(value);
|
*os << absl::StrCat(value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user