Skip to content

Commit 6ead861

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update googletest to c875c4e
PR-URL: #48964 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent b4ca4a6 commit 6ead861

File tree

8 files changed

+50
-63
lines changed

8 files changed

+50
-63
lines changed

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

+22
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
// 1. foo::PrintTo(const T&, ostream*)
4444
// 2. operator<<(ostream&, const T&) defined in either foo or the
4545
// global namespace.
46+
// * Prefer AbslStringify(..) to operator<<(..), per https://abseil.io/tips/215.
47+
// * Define foo::PrintTo(..) if the type already has AbslStringify(..), but an
48+
// alternative presentation in test results is of interest.
4649
//
4750
// However if T is an STL-style container then it is printed element-wise
4851
// unless foo::PrintTo(const T&, ostream*) is defined. Note that
@@ -112,6 +115,10 @@
112115
#include <utility>
113116
#include <vector>
114117

118+
#ifdef GTEST_HAS_ABSL
119+
#include "absl/strings/internal/has_absl_stringify.h"
120+
#include "absl/strings/str_cat.h"
121+
#endif // GTEST_HAS_ABSL
115122
#include "gtest/internal/gtest-internal.h"
116123
#include "gtest/internal/gtest-port.h"
117124

@@ -260,6 +267,18 @@ struct ConvertibleToStringViewPrinter {
260267
#endif
261268
};
262269

270+
#ifdef GTEST_HAS_ABSL
271+
struct ConvertibleToAbslStringifyPrinter {
272+
template <
273+
typename T,
274+
typename = typename std::enable_if<
275+
absl::strings_internal::HasAbslStringify<T>::value>::type> // NOLINT
276+
static void PrintValue(const T& value, ::std::ostream* os) {
277+
*os << absl::StrCat(value);
278+
}
279+
};
280+
#endif // GTEST_HAS_ABSL
281+
263282
// Prints the given number of bytes in the given object to the given
264283
// ostream.
265284
GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
@@ -308,6 +327,9 @@ void PrintWithFallback(const T& value, ::std::ostream* os) {
308327
using Printer = typename FindFirstPrinter<
309328
T, void, ContainerPrinter, FunctionPointerPrinter, PointerPrinter,
310329
ProtobufPrinter,
330+
#ifdef GTEST_HAS_ABSL
331+
ConvertibleToAbslStringifyPrinter,
332+
#endif // GTEST_HAS_ABSL
311333
internal_stream_operator_without_lexical_name_lookup::StreamPrinter,
312334
ConvertibleToIntegerPrinter, ConvertibleToStringViewPrinter,
313335
RawBytesPrinter, FallbackPrinter>::type;

deps/googletest/include/gtest/gtest.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2101,8 +2101,8 @@ class GTEST_API_ ScopedTrace {
21012101
// Assuming that each thread maintains its own stack of traces.
21022102
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
21032103
// assertions in its own thread.
2104-
#define SCOPED_TRACE(message) \
2105-
::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \
2104+
#define SCOPED_TRACE(message) \
2105+
const ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \
21062106
__FILE__, __LINE__, (message))
21072107

21082108
// Compile-time assertion for type equality.

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

+14-13
Original file line numberDiff line numberDiff line change
@@ -1497,19 +1497,20 @@ class NeverThrown {
14971497
gtest_ar_, text, #actual, #expected) \
14981498
.c_str())
14991499

1500-
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
1501-
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1502-
if (::testing::internal::AlwaysTrue()) { \
1503-
::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
1504-
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1505-
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
1506-
goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
1507-
} \
1508-
} else \
1509-
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__) \
1510-
: fail("Expected: " #statement \
1511-
" doesn't generate new fatal " \
1512-
"failures in the current thread.\n" \
1500+
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
1501+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1502+
if (::testing::internal::AlwaysTrue()) { \
1503+
const ::testing::internal::HasNewFatalFailureHelper \
1504+
gtest_fatal_failure_checker; \
1505+
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1506+
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
1507+
goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
1508+
} \
1509+
} else /* NOLINT */ \
1510+
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__) \
1511+
: fail("Expected: " #statement \
1512+
" doesn't generate new fatal " \
1513+
"failures in the current thread.\n" \
15131514
" Actual: it does.")
15141515

15151516
// Expands to the name of the class that implements the given test.

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

+2
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@
115115
#define GTEST_OS_QURT 1
116116
#elif defined(CPU_QN9090) || defined(CPU_QN9090HN)
117117
#define GTEST_OS_NXP_QN9090 1
118+
#elif defined(NRF52)
119+
#define GTEST_OS_NRF52 1
118120
#endif // __CYGWIN__
119121

120122
#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_

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

+1-42
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
506506
defined(GTEST_OS_SOLARIS) || defined(GTEST_OS_HAIKU) || \
507507
defined(GTEST_OS_ESP32) || defined(GTEST_OS_ESP8266) || \
508508
defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
509-
defined(GTEST_OS_NXP_QN9090)))
509+
defined(GTEST_OS_NXP_QN9090) || defined(GTEST_OS_NRF52)))
510510
#define GTEST_HAS_STD_WSTRING 1
511511
#else
512512
#define GTEST_HAS_STD_WSTRING 0
@@ -1146,47 +1146,6 @@ inline To ImplicitCast_(To x) {
11461146
return x;
11471147
}
11481148

1149-
// When you upcast (that is, cast a pointer from type Foo to type
1150-
// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
1151-
// always succeed. When you downcast (that is, cast a pointer from
1152-
// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
1153-
// how do you know the pointer is really of type SubclassOfFoo? It
1154-
// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
1155-
// when you downcast, you should use this macro. In debug mode, we
1156-
// use dynamic_cast<> to double-check the downcast is legal (we die
1157-
// if it's not). In normal mode, we do the efficient static_cast<>
1158-
// instead. Thus, it's important to test in debug mode to make sure
1159-
// the cast is legal!
1160-
// This is the only place in the code we should use dynamic_cast<>.
1161-
// In particular, you SHOULDN'T be using dynamic_cast<> in order to
1162-
// do RTTI (eg code like this:
1163-
// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
1164-
// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
1165-
// You should design the code some other way not to need this.
1166-
//
1167-
// This relatively ugly name is intentional. It prevents clashes with
1168-
// similar functions users may have (e.g., down_cast). The internal
1169-
// namespace alone is not enough because the function can be found by ADL.
1170-
template <typename To, typename From> // use like this: DownCast_<T*>(foo);
1171-
inline To DownCast_(From* f) { // so we only accept pointers
1172-
// Ensures that To is a sub-type of From *. This test is here only
1173-
// for compile-time type checking, and has no overhead in an
1174-
// optimized build at run-time, as it will be optimized away
1175-
// completely.
1176-
GTEST_INTENTIONAL_CONST_COND_PUSH_()
1177-
if (false) {
1178-
GTEST_INTENTIONAL_CONST_COND_POP_()
1179-
const To to = nullptr;
1180-
::testing::internal::ImplicitCast_<From*>(to);
1181-
}
1182-
1183-
#if GTEST_HAS_RTTI
1184-
// RTTI: debug mode only!
1185-
GTEST_CHECK_(f == nullptr || dynamic_cast<To>(f) != nullptr);
1186-
#endif
1187-
return static_cast<To>(f);
1188-
}
1189-
11901149
// Downcasts the pointer of type Base to Derived.
11911150
// Derived must be a subclass of Base. The parameter MUST
11921151
// point to a class of type Derived, not any subclass of it.

deps/googletest/src/gtest-filepath.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ FilePath FilePath::GetCurrentDir() {
102102
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
103103
defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_ESP8266) || \
104104
defined(GTEST_OS_ESP32) || defined(GTEST_OS_XTENSA) || \
105-
defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090)
105+
defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090) || \
106+
defined(GTEST_OS_NRF52)
106107
// These platforms do not have a current directory, so we just return
107108
// something reasonable.
108109
return FilePath(kCurrentDirectoryString);
@@ -356,7 +357,8 @@ bool FilePath::CreateFolder() const {
356357
#elif defined(GTEST_OS_WINDOWS)
357358
int result = _mkdir(pathname_.c_str());
358359
#elif defined(GTEST_OS_ESP8266) || defined(GTEST_OS_XTENSA) || \
359-
defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090)
360+
defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090) || \
361+
defined(GTEST_OS_NRF52)
360362
// do nothing
361363
int result = 0;
362364
#else

deps/googletest/src/gtest_main.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131

3232
#include "gtest/gtest.h"
3333

34-
#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32)
34+
#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32) || \
35+
(defined(GTEST_OS_NRF52) && defined(ARDUINO))
3536
// Arduino-like platforms: program entry points are setup/loop instead of main.
3637

3738
#ifdef GTEST_OS_ESP8266

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 cc36671][]
18+
* [googletest c875c4e][]
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 cc36671
192+
### googletest c875c4e
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 cc36671]: #googletest-cc36671
329+
[googletest c875c4e]: #googletest-c875c4e
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)