Skip to content

Commit

Permalink
deps: update googletest to 7e33b6a
Browse files Browse the repository at this point in the history
PR-URL: #49034
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
  • Loading branch information
nodejs-github-bot authored and RafaelGSS committed Aug 17, 2023
1 parent 995cbf9 commit e14f045
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 26 deletions.
36 changes: 34 additions & 2 deletions deps/googletest/include/gtest/gtest-message.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@

#include "gtest/internal/gtest-port.h"

#ifdef GTEST_HAS_ABSL
#include <type_traits>

#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 */)

Expand Down Expand Up @@ -111,8 +118,17 @@ class GTEST_API_ Message {
*ss_ << str;
}

// Streams a non-pointer value to this object.
template <typename T>
// 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 <typename T
#ifdef GTEST_HAS_ABSL
,
typename std::enable_if<
!absl::strings_internal::HasAbslStringify<T>::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.
Expand All @@ -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 <typename T,
typename std::enable_if<
absl::strings_internal::HasAbslStringify<T>::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
Expand Down
9 changes: 4 additions & 5 deletions deps/googletest/include/gtest/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@

#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <limits>
#include <memory>
#include <ostream>
Expand Down Expand Up @@ -1574,12 +1573,12 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
}

::std::stringstream lhs_ss;
lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
<< lhs_value;
lhs_ss.precision(std::numeric_limits<RawType>::digits10 + 2);
lhs_ss << lhs_value;

::std::stringstream rhs_ss;
rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
<< rhs_value;
rhs_ss.precision(std::numeric_limits<RawType>::digits10 + 2);
rhs_ss << rhs_value;

return EqFailure(lhs_expression, rhs_expression,
StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss),
Expand Down
1 change: 0 additions & 1 deletion deps/googletest/include/gtest/internal/gtest-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

#include <cstdint>
#include <functional>
#include <iomanip>
#include <limits>
#include <map>
#include <set>
Expand Down
18 changes: 4 additions & 14 deletions deps/googletest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1153,17 +1148,12 @@ inline To ImplicitCast_(To x) {
// check to enforce this.
template <class Derived, class Base>
Derived* CheckedDowncastToActualType(Base* base) {
static_assert(std::is_base_of<Base, Derived>::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<Derived*>(base);
#elif GTEST_HAS_RTTI
return dynamic_cast<Derived*>(base); // NOLINT
#else
return static_cast<Derived*>(base); // Poor man's downcast.
GTEST_CHECK_(base == nullptr || dynamic_cast<Derived*>(base) != nullptr);
#endif
return static_cast<Derived*>(base);
}

#if GTEST_HAS_STREAM_REDIRECTION
Expand Down
2 changes: 1 addition & 1 deletion deps/googletest/src/gtest-internal-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions doc/contributing/maintaining/maintaining-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This a list of all the dependencies:
* [c-ares 1.19.0][]
* [cjs-module-lexer 1.2.2][]
* [corepack][]
* [googletest c875c4e][]
* [googletest 7e33b6a][]
* [histogram 0.11.8][]
* [icu-small 73.2][]
* [libuv 1.46.0][]
Expand Down Expand Up @@ -189,7 +189,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.
Expand Down Expand Up @@ -326,7 +326,7 @@ performance improvements not currently available in standard zlib.
[cjs-module-lexer 1.2.2]: #cjs-module-lexer-122
[corepack]: #corepack
[dependency-update-action]: ../../../.github/workflows/tools.yml
[googletest c875c4e]: #googletest-c875c4e
[googletest 7e33b6a]: #googletest-7e33b6a
[histogram 0.11.8]: #histogram-0118
[icu-small 73.2]: #icu-small-732
[libuv 1.46.0]: #libuv-1460
Expand Down

0 comments on commit e14f045

Please sign in to comment.