deps: update googletest to d89aac5f0dd4021198d903d39de16f896726de21 · nodejs/node@4160dfd · GitHub
Skip to content

Commit 4160dfd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update googletest to d89aac5f0dd4021198d903d39de16f896726de21
PR-URL: #65153 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 631d3aa commit 4160dfd

8 files changed

Lines changed: 62 additions & 58 deletions

File tree

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

Lines changed: 33 additions & 17 deletions

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,9 @@ struct ConvertibleToIntegerPrinter {
291291
};
292292

293293
struct ConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
static void PrintValue(internal::StringView value, ::std::ostream* os) {
296295
internal::UniversalPrint(value, os);
297296
}
298-
#endif
299297
};
300298

301299
#ifdef GTEST_HAS_ABSL
@@ -703,12 +701,12 @@ void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
703701
}
704702
}
705703

706-
// Overloads for ::std::string and ::std::string_view
707-
GTEST_API_ void PrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_ void PrintStringTo(std::string_view s, ::std::ostream* os);
708706
inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inline void PrintTo(::std::string_view s, ::std::ostream* os) {
709+
inline void PrintTo(std::string_view s, ::std::ostream* os) {
712710
PrintStringTo(s, os);
713711
}
714712

@@ -752,16 +750,14 @@ inline void PrintTo(::std::wstring_view s, ::std::ostream* os) {
752750
}
753751
#endif // GTEST_HAS_STD_WSTRING
754752

755-
#if GTEST_INTERNAL_HAS_STRING_VIEW
756753
// Overload for internal::StringView. Needed for build configurations where
757754
// internal::StringView is an alias for absl::string_view, but absl::string_view
758755
// is a distinct type from std::string_view.
759756
template <int&... ExplicitArgumentBarrier, typename T = internal::StringView,
760-
std::enable_if_t<!std::is_same_v<T, ::std::string_view>, int> = 0>
757+
std::enable_if_t<!std::is_same_v<T, std::string_view>, int> = 0>
761758
inline void PrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif // GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; }
767763

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
#include <memory>
4545
#include <string>
46+
#include <string_view>
4647

4748
#include "gtest/gtest-matchers.h"
4849
#include "gtest/internal/gtest-internal.h"
@@ -63,6 +64,10 @@ inline Matcher<const ::std::string&> MakeDeathTestMatcher(
6364
::testing::internal::RE regex) {
6465
return ContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
return ContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(const char* regex) {
6772
return ContainsRegex(regex);
6873
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,13 +1451,13 @@ class [[nodiscard]] NeverThrown {
14511451
// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
14521452
// either a boolean expression or an AssertionResult. text is a textual
14531453
// representation of expression as it was passed into the EXPECT_TRUE.
1454-
#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
1455-
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1456-
if (::testing::internal::AssertionResultExpectation gtest_are_ = { \
1457-
::testing::AssertionResult(expression), expected}) \
1458-
; \
1459-
else \
1460-
fail(::testing::internal::GetBoolAssertionFailureMessage( \
1454+
#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
1455+
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1456+
if (const ::testing::internal::AssertionResultExpectation gtest_are_ = { \
1457+
::testing::AssertionResult(expression), expected}) \
1458+
; \
1459+
else /* NOLINT */ \
1460+
fail(::testing::internal::GetBoolAssertionFailureMessage( \
14611461
gtest_are_.assertion_result, text, #actual, #expected))
14621462

14631463
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \

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

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,10 @@
293293
#include <limits>
294294
#include <locale>
295295
#include <memory>
296+
// #include <mutex> // Guarded by GTEST_IS_THREADSAFE below
296297
#include <ostream>
297298
#include <string>
298-
// #include <mutex> // Guarded by GTEST_IS_THREADSAFE below
299+
#include <string_view>
299300
#include <tuple>
300301
#include <type_traits>
301302
#include <vector>
@@ -949,21 +950,21 @@ GTEST_API_ bool IsTrue(bool condition);
949950
#ifdef GTEST_USES_RE2
950951

951952
// This is almost `using RE = ::RE2`, except it is copy-constructible, and it
952-
// needs to disambiguate the `std::string`, `absl::string_view`, and `const
953+
// needs to disambiguate the `std::string`, `std::string_view`, and `const
953954
// char*` constructors.
954955
class GTEST_API_ [[nodiscard]] RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(const char* regex) : RE(absl::string_view(regex)) {} // NOLINT
958-
RE(const std::string& regex) : RE(absl::string_view(regex)) {} // NOLINT
957+
RE(std::string_view regex) : regex_(regex) {} // NOLINT
958+
RE(const char* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(const RE& other) : RE(other.pattern()) {}
960961

961962
const std::string& pattern() const { return regex_.pattern(); }
962963

963-
static bool FullMatch(absl::string_view str, const RE& re) {
964+
static bool FullMatch(std::string_view str, const RE& re) {
964965
return RE2::FullMatch(str, re.regex_);
965966
}
966-
static bool PartialMatch(absl::string_view str, const RE& re) {
967+
static bool PartialMatch(std::string_view str, const RE& re) {
967968
return RE2::PartialMatch(str, re.regex_);
968969
}
969970

@@ -2396,34 +2397,22 @@ const char* StringFromGTestEnv(const char* flag, const char* default_val);
23962397
#ifdef GTEST_HAS_ABSL
23972398
// Always use absl::string_view for Matcher<> specializations if googletest
23982399
// is built with absl support.
2399-
#define GTEST_INTERNAL_HAS_STRING_VIEW 1
24002400
#include "absl/strings/string_view.h"
24012401
namespace testing {
24022402
namespace internal {
24032403
using StringView = ::absl::string_view;
24042404
} // namespace internal
24052405
} // namespace testing
24062406
#else
2407-
#if defined(__cpp_lib_string_view) || \
2408-
(GTEST_INTERNAL_HAS_INCLUDE(<string_view>) && \
2409-
GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L)
24102407
// Otherwise for C++17 and higher use std::string_view for Matcher<>
24112408
// specializations.
2412-
#define GTEST_INTERNAL_HAS_STRING_VIEW 1
2413-
#include <string_view>
24142409
namespace testing {
24152410
namespace internal {
2416-
using StringView = ::std::string_view;
2411+
using StringView = std::string_view;
24172412
} // namespace internal
24182413
} // namespace testing
2419-
// The case where absl is configured NOT to alias std::string_view is not
2420-
// supported.
2421-
#endif // __cpp_lib_string_view
24222414
#endif // GTEST_HAS_ABSL
2423-
2424-
#ifndef GTEST_INTERNAL_HAS_STRING_VIEW
2425-
#define GTEST_INTERNAL_HAS_STRING_VIEW 0
2426-
#endif
2415+
#define GTEST_INTERNAL_HAS_STRING_VIEW 1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#define GTEST_INTERNAL_HAS_COMPARE_LIB 1

deps/googletest/src/gtest-matchers.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Matcher<std::string>::Matcher(const std::string& s) { *this = Eq(s); }
5959
// s.
6060
Matcher<std::string>::Matcher(const char* s) { *this = Eq(std::string(s)); }
6161

62-
#if GTEST_INTERNAL_HAS_STRING_VIEW
6362
// Constructs a matcher that matches a const StringView& whose value is
6463
// equal to s.
6564
Matcher<const internal::StringView&>::Matcher(const std::string& s) {
@@ -93,6 +92,5 @@ Matcher<internal::StringView>::Matcher(const char* s) {
9392
Matcher<internal::StringView>::Matcher(internal::StringView s) {
9493
*this = Eq(std::string(s));
9594
}
96-
#endif // GTEST_INTERNAL_HAS_STRING_VIEW
9795

9896
} // namespace testing

deps/googletest/src/gtest-printers.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,13 +515,13 @@ bool IsValidUTF8(const char* str, size_t length) {
515515
void ConditionalPrintAsText(const char* str, size_t length, ostream* os) {
516516
if (!ContainsUnprintableControlCodes(str, length) &&
517517
IsValidUTF8(str, length)) {
518-
*os << "\n As Text: \"" << ::std::string_view(str, length) << "\"";
518+
*os << "\n As Text: \"" << std::string_view(str, length) << "\"";
519519
}
520520
}
521521

522522
} // anonymous namespace
523523

524-
void PrintStringTo(::std::string_view s, ostream* os) {
524+
void PrintStringTo(std::string_view s, ostream* os) {
525525
if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) {
526526
if (GTEST_FLAG_GET(print_utf8)) {
527527
ConditionalPrintAsText(s.data(), s.size(), os);

deps/googletest/src/gtest.cc

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)