Skip to content

Commit 6ead861

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update googletest to c875c4e
PR-URL: #48964 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent b4ca4a6 commit 6ead861

8 files changed

Lines changed: 50 additions & 63 deletions

File tree

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

Lines changed: 22 additions & 0 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 14 additions & 13 deletions
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