Skip to content

Commit e14f045

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update googletest to 7e33b6a
PR-URL: #49034 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 995cbf9 commit e14f045

File tree

6 files changed

+46
-26
lines changed

6 files changed

+46
-26
lines changed

deps/googletest/include/gtest/gtest-message.h

+34-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656

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

59+
#ifdef GTEST_HAS_ABSL
60+
#include <type_traits>
61+
62+
#include "absl/strings/internal/has_absl_stringify.h"
63+
#include "absl/strings/str_cat.h"
64+
#endif // GTEST_HAS_ABSL
65+
5966
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
6067
/* class A needs to have dll-interface to be used by clients of class B */)
6168

@@ -111,8 +118,17 @@ class GTEST_API_ Message {
111118
*ss_ << str;
112119
}
113120

114-
// Streams a non-pointer value to this object.
115-
template <typename T>
121+
// Streams a non-pointer value to this object. If building a version of
122+
// GoogleTest with ABSL, this overload is only enabled if the value does not
123+
// have an AbslStringify definition.
124+
template <typename T
125+
#ifdef GTEST_HAS_ABSL
126+
,
127+
typename std::enable_if<
128+
!absl::strings_internal::HasAbslStringify<T>::value, // NOLINT
129+
int>::type = 0
130+
#endif // GTEST_HAS_ABSL
131+
>
116132
inline Message& operator<<(const T& val) {
117133
// Some libraries overload << for STL containers. These
118134
// overloads are defined in the global namespace instead of ::std.
@@ -133,6 +149,22 @@ class GTEST_API_ Message {
133149
return *this;
134150
}
135151

152+
#ifdef GTEST_HAS_ABSL
153+
// Streams a non-pointer value with an AbslStringify definition to this
154+
// object.
155+
template <typename T,
156+
typename std::enable_if<
157+
absl::strings_internal::HasAbslStringify<T>::value, // NOLINT
158+
int>::type = 0>
159+
inline Message& operator<<(const T& val) {
160+
// ::operator<< is needed here for a similar reason as with the non-Abseil
161+
// version above
162+
using ::operator<<;
163+
*ss_ << absl::StrCat(val);
164+
return *this;
165+
}
166+
#endif // GTEST_HAS_ABSL
167+
136168
// Streams a pointer value to this object.
137169
//
138170
// This function is an overload of the previous one. When you

deps/googletest/include/gtest/gtest.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151

5252
#include <cstddef>
5353
#include <cstdint>
54-
#include <iomanip>
5554
#include <limits>
5655
#include <memory>
5756
#include <ostream>
@@ -1574,12 +1573,12 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
15741573
}
15751574

15761575
::std::stringstream lhs_ss;
1577-
lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1578-
<< lhs_value;
1576+
lhs_ss.precision(std::numeric_limits<RawType>::digits10 + 2);
1577+
lhs_ss << lhs_value;
15791578

15801579
::std::stringstream rhs_ss;
1581-
rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1582-
<< rhs_value;
1580+
rhs_ss.precision(std::numeric_limits<RawType>::digits10 + 2);
1581+
rhs_ss << rhs_value;
15831582

15841583
return EqFailure(lhs_expression, rhs_expression,
15851584
StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss),

deps/googletest/include/gtest/internal/gtest-internal.h

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858

5959
#include <cstdint>
6060
#include <functional>
61-
#include <iomanip>
6261
#include <limits>
6362
#include <map>
6463
#include <set>

deps/googletest/include/gtest/internal/gtest-port.h

+4-14
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@
220220
// GTEST_HAS_ALT_PATH_SEP_ - Always defined to 0 or 1.
221221
// GTEST_WIDE_STRING_USES_UTF16_ - Always defined to 0 or 1.
222222
// GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Always defined to 0 or 1.
223-
// GTEST_HAS_DOWNCAST_ - Always defined to 0 or 1.
224223
// GTEST_HAS_NOTIFICATION_- Always defined to 0 or 1.
225224
//
226225
// Synchronization:
@@ -313,10 +312,6 @@
313312
#include "gtest/internal/custom/gtest-port.h"
314313
#include "gtest/internal/gtest-port-arch.h"
315314

316-
#ifndef GTEST_HAS_DOWNCAST_
317-
#define GTEST_HAS_DOWNCAST_ 0
318-
#endif
319-
320315
#ifndef GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
321316
#define GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ 0
322317
#endif
@@ -1153,17 +1148,12 @@ inline To ImplicitCast_(To x) {
11531148
// check to enforce this.
11541149
template <class Derived, class Base>
11551150
Derived* CheckedDowncastToActualType(Base* base) {
1151+
static_assert(std::is_base_of<Base, Derived>::value,
1152+
"target type not derived from source type");
11561153
#if GTEST_HAS_RTTI
1157-
GTEST_CHECK_(typeid(*base) == typeid(Derived));
1158-
#endif
1159-
1160-
#if GTEST_HAS_DOWNCAST_
1161-
return ::down_cast<Derived*>(base);
1162-
#elif GTEST_HAS_RTTI
1163-
return dynamic_cast<Derived*>(base); // NOLINT
1164-
#else
1165-
return static_cast<Derived*>(base); // Poor man's downcast.
1154+
GTEST_CHECK_(base == nullptr || dynamic_cast<Derived*>(base) != nullptr);
11661155
#endif
1156+
return static_cast<Derived*>(base);
11671157
}
11681158

11691159
#if GTEST_HAS_STREAM_REDIRECTION

deps/googletest/src/gtest-internal-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ class GTEST_API_ UnitTestImpl {
672672
void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc,
673673
internal::TearDownTestSuiteFunc tear_down_tc,
674674
TestInfo* test_info) {
675-
#ifdef GTEST_HAS_FILE_SYSTEM
675+
#if GTEST_HAS_FILE_SYSTEM
676676
// In order to support thread-safe death tests, we need to
677677
// remember the original working directory when the test program
678678
// was first invoked. We cannot do this in RUN_ALL_TESTS(), as

doc/contributing/maintaining/maintaining-dependencies.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This a list of all the dependencies:
1515
* [c-ares 1.19.0][]
1616
* [cjs-module-lexer 1.2.2][]
1717
* [corepack][]
18-
* [googletest c875c4e][]
18+
* [googletest 7e33b6a][]
1919
* [histogram 0.11.8][]
2020
* [icu-small 73.2][]
2121
* [libuv 1.46.0][]
@@ -189,7 +189,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to
189189
install them - just like what currently happens with npm, which is shipped
190190
by Node.js by default.
191191

192-
### googletest c875c4e
192+
### googletest 7e33b6a
193193

194194
The [googletest](https://github.com/google/googletest) dependency is Google’s
195195
C++ testing and mocking framework.
@@ -326,7 +326,7 @@ performance improvements not currently available in standard zlib.
326326
[cjs-module-lexer 1.2.2]: #cjs-module-lexer-122
327327
[corepack]: #corepack
328328
[dependency-update-action]: ../../../.github/workflows/tools.yml
329-
[googletest c875c4e]: #googletest-c875c4e
329+
[googletest 7e33b6a]: #googletest-7e33b6a
330330
[histogram 0.11.8]: #histogram-0118
331331
[icu-small 73.2]: #icu-small-732
332332
[libuv 1.46.0]: #libuv-1460

0 commit comments

Comments
 (0)