diff --git a/deps/googletest/include/gtest/gtest-message.h b/deps/googletest/include/gtest/gtest-message.h index 4d4b152b1d8b70..59b805e4e4622c 100644 --- a/deps/googletest/include/gtest/gtest-message.h +++ b/deps/googletest/include/gtest/gtest-message.h @@ -56,6 +56,13 @@ #include "gtest/internal/gtest-port.h" +#ifdef GTEST_HAS_ABSL +#include + +#include "absl/strings/internal/has_absl_stringify.h" +#include "absl/strings/str_cat.h" +#endif // GTEST_HAS_ABSL + GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) @@ -111,8 +118,17 @@ class GTEST_API_ Message { *ss_ << str; } - // Streams a non-pointer value to this object. - template + // 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 + // have an AbslStringify definition. + template ::value, // NOLINT + int>::type = 0 +#endif // GTEST_HAS_ABSL + > inline Message& operator<<(const T& val) { // Some libraries overload << for STL containers. These // overloads are defined in the global namespace instead of ::std. @@ -133,6 +149,22 @@ class GTEST_API_ Message { return *this; } +#ifdef GTEST_HAS_ABSL + // Streams a non-pointer value with an AbslStringify definition to this + // object. + template ::value, // NOLINT + int>::type = 0> + inline Message& operator<<(const T& val) { + // ::operator<< is needed here for a similar reason as with the non-Abseil + // version above + using ::operator<<; + *ss_ << absl::StrCat(val); + return *this; + } +#endif // GTEST_HAS_ABSL + // Streams a pointer value to this object. // // This function is an overload of the previous one. When you diff --git a/deps/googletest/include/gtest/gtest.h b/deps/googletest/include/gtest/gtest.h index de7d528fc687bb..a932e686af4f44 100644 --- a/deps/googletest/include/gtest/gtest.h +++ b/deps/googletest/include/gtest/gtest.h @@ -51,7 +51,6 @@ #include #include -#include #include #include #include @@ -1574,12 +1573,12 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression, } ::std::stringstream lhs_ss; - lhs_ss << std::setprecision(std::numeric_limits::digits10 + 2) - << lhs_value; + lhs_ss.precision(std::numeric_limits::digits10 + 2); + lhs_ss << lhs_value; ::std::stringstream rhs_ss; - rhs_ss << std::setprecision(std::numeric_limits::digits10 + 2) - << rhs_value; + rhs_ss.precision(std::numeric_limits::digits10 + 2); + rhs_ss << rhs_value; return EqFailure(lhs_expression, rhs_expression, StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss), diff --git a/deps/googletest/include/gtest/internal/gtest-internal.h b/deps/googletest/include/gtest/internal/gtest-internal.h index a04a9201c616de..97a983393a34ff 100644 --- a/deps/googletest/include/gtest/internal/gtest-internal.h +++ b/deps/googletest/include/gtest/internal/gtest-internal.h @@ -58,7 +58,6 @@ #include #include -#include #include #include #include diff --git a/deps/googletest/include/gtest/internal/gtest-port.h b/deps/googletest/include/gtest/internal/gtest-port.h index 656df2606e4835..b887e24edcd05e 100644 --- a/deps/googletest/include/gtest/internal/gtest-port.h +++ b/deps/googletest/include/gtest/internal/gtest-port.h @@ -220,7 +220,6 @@ // GTEST_HAS_ALT_PATH_SEP_ - Always defined to 0 or 1. // GTEST_WIDE_STRING_USES_UTF16_ - Always defined to 0 or 1. // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Always defined to 0 or 1. -// GTEST_HAS_DOWNCAST_ - Always defined to 0 or 1. // GTEST_HAS_NOTIFICATION_- Always defined to 0 or 1. // // Synchronization: @@ -313,10 +312,6 @@ #include "gtest/internal/custom/gtest-port.h" #include "gtest/internal/gtest-port-arch.h" -#ifndef GTEST_HAS_DOWNCAST_ -#define GTEST_HAS_DOWNCAST_ 0 -#endif - #ifndef GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ #define GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ 0 #endif @@ -1153,17 +1148,12 @@ inline To ImplicitCast_(To x) { // check to enforce this. template Derived* CheckedDowncastToActualType(Base* base) { + static_assert(std::is_base_of::value, + "target type not derived from source type"); #if GTEST_HAS_RTTI - GTEST_CHECK_(typeid(*base) == typeid(Derived)); -#endif - -#if GTEST_HAS_DOWNCAST_ - return ::down_cast(base); -#elif GTEST_HAS_RTTI - return dynamic_cast(base); // NOLINT -#else - return static_cast(base); // Poor man's downcast. + GTEST_CHECK_(base == nullptr || dynamic_cast(base) != nullptr); #endif + return static_cast(base); } #if GTEST_HAS_STREAM_REDIRECTION diff --git a/deps/googletest/src/gtest-internal-inl.h b/deps/googletest/src/gtest-internal-inl.h index 1e9b5c266dd67c..5b7fcbd065091c 100644 --- a/deps/googletest/src/gtest-internal-inl.h +++ b/deps/googletest/src/gtest-internal-inl.h @@ -672,7 +672,7 @@ class GTEST_API_ UnitTestImpl { void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc, internal::TearDownTestSuiteFunc tear_down_tc, TestInfo* test_info) { -#ifdef GTEST_HAS_FILE_SYSTEM +#if GTEST_HAS_FILE_SYSTEM // In order to support thread-safe death tests, we need to // remember the original working directory when the test program // was first invoked. We cannot do this in RUN_ALL_TESTS(), as diff --git a/doc/contributing/maintaining/maintaining-dependencies.md b/doc/contributing/maintaining/maintaining-dependencies.md index 5e96a69e53f636..2a71075c4f00bd 100644 --- a/doc/contributing/maintaining/maintaining-dependencies.md +++ b/doc/contributing/maintaining/maintaining-dependencies.md @@ -15,7 +15,7 @@ This a list of all the dependencies: * [c-ares 1.20.1][] * [cjs-module-lexer][] * [corepack][] -* [googletest c875c4e][] +* [googletest 7e33b6a][] * [histogram][] * [icu-small][] * [llhttp][] @@ -187,7 +187,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to install them - just like what currently happens with npm, which is shipped by Node.js by default. -### googletest c875c4e +### googletest 7e33b6a The [googletest](https://github.com/google/googletest) dependency is Google’s C++ testing and mocking framework. @@ -319,7 +319,7 @@ performance improvements not currently available in standard zlib. [cjs-module-lexer]: #cjs-module-lexer [corepack]: #corepack [dependency-update-action]: ../../../.github/workflows/tools.yml -[googletest c875c4e]: #googletest-c875c4e +[googletest 7e33b6a]: #googletest-7e33b6a [histogram]: #histogram [icu-small]: #icu-small [llhttp]: #llhttp