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
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include<memory>
4646
#include<ostream>
4747
#include<string>
48+
#include<string_view>
4849
#include<type_traits>
4950

5051
#include"gtest/gtest-printers.h"
@@ -543,9 +544,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
543544
Matcher(constchar* s); // NOLINT
544545
};
545546

546-
#if GTEST_INTERNAL_HAS_STRING_VIEW
547547
// The following two specializations allow the user to write str
548-
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
548+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string_view
549549
// matcher is expected.
550550
template <>
551551
classGTEST_API_[[nodiscard]] Matcher<const internal::StringView&>
@@ -569,7 +569,7 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
569569
// Allows the user to write "foo" instead of Eq("foo") sometimes.
570570
Matcher(constchar* s); // NOLINT
571571

572-
// Allows the user to pass absl::string_views or std::string_views directly.
572+
// Allows the user to pass std::string_views directly.
573573
Matcher(internal::StringView s); // NOLINT
574574
};
575575

@@ -596,10 +596,9 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
596596
// Allows the user to write "foo" instead of Eq("foo") sometimes.
597597
Matcher(constchar* s); // NOLINT
598598

599-
// Allows the user to pass absl::string_views or std::string_views directly.
599+
// Allows the user to pass std::string_views directly.
600600
Matcher(internal::StringView s); // NOLINT
601601
};
602-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
603602

604603
// Prints a matcher in a human-readable format.
605604
template <typename T>
@@ -812,9 +811,26 @@ class [[nodiscard]] ImplicitCastEqMatcher {
812811
StoredRhs stored_rhs_;
813812
};
814813

815-
template <typename T,
816-
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
817-
using StringLike = T;
814+
// Dummy function (never defined) whose return type evaluates to std::string if
815+
// the given type is a string-like type that can be converted to std::string,
816+
// either directly or through an intermediate std::string_view.
817+
template <classT>
818+
extern std::enable_if_t<std::is_constructible_v<std::string, T>, std::string>
819+
ResolveAsString(constvoid* /* preferred */);
820+
821+
#if GTEST_HAS_STD_WSTRING
822+
// Same as above, but for std::wstring. In cases where both conversions are
823+
// possible, this overload takes lower priority.
824+
template <classT>
825+
extern std::enable_if_t<std::is_constructible_v<std::wstring, T>, std::wstring>
826+
ResolveAsString(... /* fallback */);
827+
#endif
828+
829+
// Evaluates to the std::basic_string type that the given string-like type can
830+
// be converted to. Prefers std::string over std::wstring if both are possible.
831+
// Fails in a SFINAE-friendly way if no conversion was viable.
832+
template <typename T>
833+
using StringType = decltype(ResolveAsString<T>(nullptr));
818834

819835
// Implements polymorphic matchers MatchesRegex(regex) and
820836
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
@@ -824,12 +840,10 @@ class [[nodiscard]] MatchesRegexMatcher {
824840
MatchesRegexMatcher(constRE* regex, bool full_match)
825841
: regex_(regex), full_match_(full_match) {}
826842

827-
#if GTEST_INTERNAL_HAS_STRING_VIEW
828843
boolMatchAndExplain(const internal::StringView& s,
829844
MatchResultListener* listener) const {
830845
returnMatchAndExplain(std::string(s), listener);
831846
}
832-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
833847

834848
// Accepts pointer types, particularly:
835849
// const char*
@@ -844,7 +858,7 @@ class [[nodiscard]] MatchesRegexMatcher {
844858
// Matches anything that can convert to std::string.
845859
//
846860
// This is a template, not just a plain function with const std::string&,
847-
// because absl::string_view has some interfering non-explicit constructors.
861+
// because std::string_view has some interfering non-explicit constructors.
848862
template <classMatcheeStringType>
849863
boolMatchAndExplain(const MatcheeStringType& s,
850864
MatchResultListener* /* listener */) const {
@@ -877,9 +891,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
877891
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
878892
}
879893
template <typename T = std::string>
880-
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
881-
const internal::StringLike<T>& regex) {
882-
returnMatchesRegex(newinternal::RE(std::string(regex)));
894+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
895+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
896+
MatchesRegex(const T& regex) {
897+
returnMatchesRegex(newinternal::RE(internal::StringType<T>(regex)));
883898
}
884899

885900
// Matches a string that contains regular expression 'regex'.
@@ -889,9 +904,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
889904
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
890905
}
891906
template <typename T = std::string>
892-
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
893-
const internal::StringLike<T>& regex) {
894-
returnContainsRegex(newinternal::RE(std::string(regex)));
907+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
908+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
909+
ContainsRegex(const T& regex) {
910+
returnContainsRegex(newinternal::RE(internal::StringType<T>(regex)));
895911
}
896912

897913
// Creates a polymorphic matcher that matches anything equal to x.

‎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
structConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
staticvoidPrintValue(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_voidPrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_voidPrintStringTo(std::string_view s, ::std::ostream* os);
708706
inlinevoidPrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inlinevoidPrintTo(::std::string_view s, ::std::ostream* os) {
709+
inlinevoidPrintTo(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
inlinevoidPrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inlinevoidPrintTo(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
returnContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
returnContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(constchar* regex) {
6772
returnContainsRegex(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-
#defineGTEST_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+
#defineGTEST_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
#defineGTEST_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
classGTEST_API_[[nodiscard]]RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(constchar* 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(constchar* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(constRE& other) : RE(other.pattern()) {}
960961

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

963-
staticboolFullMatch(absl::string_view str, constRE& re) {
964+
staticboolFullMatch(std::string_view str, constRE& re) {
964965
returnRE2::FullMatch(str, re.regex_);
965966
}
966-
staticboolPartialMatch(absl::string_view str, constRE& re) {
967+
staticboolPartialMatch(std::string_view str, constRE& re) {
967968
returnRE2::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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24002400
#include"absl/strings/string_view.h"
24012401
namespacetesting {
24022402
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
2413-
#include<string_view>
24142409
namespacetesting {
24152410
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW0
2426-
#endif
2415+
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#defineGTEST_INTERNAL_HAS_COMPARE_LIB1

‎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(constchar* 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
voidConditionalPrintAsText(constchar* 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-
voidPrintStringTo(::std::string_view s, ostream* os) {
524+
voidPrintStringTo(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
Original file line numberDiff line numberDiff line change
@@ -6930,7 +6930,7 @@ void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
69306930
std::vector<char*> positional_args;
69316931
std::vector<absl::UnrecognizedFlag> unrecognized_flags;
69326932
absl::ParseAbseilFlagsOnly(*argc, argv, positional_args, unrecognized_flags);
6933-
absl::flat_hash_set<absl::string_view> unrecognized;
6933+
absl::flat_hash_set<std::string_view> unrecognized;
69346934
for (constauto& flag : unrecognized_flags) {
69356935
unrecognized.insert(flag.flag_name);
69366936
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
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
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include<memory>
4646
#include<ostream>
4747
#include<string>
48+
#include<string_view>
4849
#include<type_traits>
4950

5051
#include"gtest/gtest-printers.h"
@@ -543,9 +544,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
543544
Matcher(constchar* s); // NOLINT
544545
};
545546

546-
#if GTEST_INTERNAL_HAS_STRING_VIEW
547547
// The following two specializations allow the user to write str
548-
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
548+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string_view
549549
// matcher is expected.
550550
template <>
551551
classGTEST_API_[[nodiscard]] Matcher<const internal::StringView&>
@@ -569,7 +569,7 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
569569
// Allows the user to write "foo" instead of Eq("foo") sometimes.
570570
Matcher(constchar* s); // NOLINT
571571

572-
// Allows the user to pass absl::string_views or std::string_views directly.
572+
// Allows the user to pass std::string_views directly.
573573
Matcher(internal::StringView s); // NOLINT
574574
};
575575

@@ -596,10 +596,9 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
596596
// Allows the user to write "foo" instead of Eq("foo") sometimes.
597597
Matcher(constchar* s); // NOLINT
598598

599-
// Allows the user to pass absl::string_views or std::string_views directly.
599+
// Allows the user to pass std::string_views directly.
600600
Matcher(internal::StringView s); // NOLINT
601601
};
602-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
603602

604603
// Prints a matcher in a human-readable format.
605604
template <typename T>
@@ -812,9 +811,26 @@ class [[nodiscard]] ImplicitCastEqMatcher {
812811
StoredRhs stored_rhs_;
813812
};
814813

815-
template <typename T,
816-
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
817-
using StringLike = T;
814+
// Dummy function (never defined) whose return type evaluates to std::string if
815+
// the given type is a string-like type that can be converted to std::string,
816+
// either directly or through an intermediate std::string_view.
817+
template <classT>
818+
extern std::enable_if_t<std::is_constructible_v<std::string, T>, std::string>
819+
ResolveAsString(constvoid* /* preferred */);
820+
821+
#if GTEST_HAS_STD_WSTRING
822+
// Same as above, but for std::wstring. In cases where both conversions are
823+
// possible, this overload takes lower priority.
824+
template <classT>
825+
extern std::enable_if_t<std::is_constructible_v<std::wstring, T>, std::wstring>
826+
ResolveAsString(... /* fallback */);
827+
#endif
828+
829+
// Evaluates to the std::basic_string type that the given string-like type can
830+
// be converted to. Prefers std::string over std::wstring if both are possible.
831+
// Fails in a SFINAE-friendly way if no conversion was viable.
832+
template <typename T>
833+
using StringType = decltype(ResolveAsString<T>(nullptr));
818834

819835
// Implements polymorphic matchers MatchesRegex(regex) and
820836
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
@@ -824,12 +840,10 @@ class [[nodiscard]] MatchesRegexMatcher {
824840
MatchesRegexMatcher(constRE* regex, bool full_match)
825841
: regex_(regex), full_match_(full_match) {}
826842

827-
#if GTEST_INTERNAL_HAS_STRING_VIEW
828843
boolMatchAndExplain(const internal::StringView& s,
829844
MatchResultListener* listener) const {
830845
returnMatchAndExplain(std::string(s), listener);
831846
}
832-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
833847

834848
// Accepts pointer types, particularly:
835849
// const char*
@@ -844,7 +858,7 @@ class [[nodiscard]] MatchesRegexMatcher {
844858
// Matches anything that can convert to std::string.
845859
//
846860
// This is a template, not just a plain function with const std::string&,
847-
// because absl::string_view has some interfering non-explicit constructors.
861+
// because std::string_view has some interfering non-explicit constructors.
848862
template <classMatcheeStringType>
849863
boolMatchAndExplain(const MatcheeStringType& s,
850864
MatchResultListener* /* listener */) const {
@@ -877,9 +891,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
877891
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
878892
}
879893
template <typename T = std::string>
880-
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
881-
const internal::StringLike<T>& regex) {
882-
returnMatchesRegex(newinternal::RE(std::string(regex)));
894+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
895+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
896+
MatchesRegex(const T& regex) {
897+
returnMatchesRegex(newinternal::RE(internal::StringType<T>(regex)));
883898
}
884899

885900
// Matches a string that contains regular expression 'regex'.
@@ -889,9 +904,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
889904
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
890905
}
891906
template <typename T = std::string>
892-
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
893-
const internal::StringLike<T>& regex) {
894-
returnContainsRegex(newinternal::RE(std::string(regex)));
907+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
908+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
909+
ContainsRegex(const T& regex) {
910+
returnContainsRegex(newinternal::RE(internal::StringType<T>(regex)));
895911
}
896912

897913
// Creates a polymorphic matcher that matches anything equal to x.

‎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
structConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
staticvoidPrintValue(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_voidPrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_voidPrintStringTo(std::string_view s, ::std::ostream* os);
708706
inlinevoidPrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inlinevoidPrintTo(::std::string_view s, ::std::ostream* os) {
709+
inlinevoidPrintTo(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
inlinevoidPrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inlinevoidPrintTo(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
returnContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
returnContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(constchar* regex) {
6772
returnContainsRegex(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-
#defineGTEST_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+
#defineGTEST_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
#defineGTEST_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
classGTEST_API_[[nodiscard]]RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(constchar* 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(constchar* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(constRE& other) : RE(other.pattern()) {}
960961

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

963-
staticboolFullMatch(absl::string_view str, constRE& re) {
964+
staticboolFullMatch(std::string_view str, constRE& re) {
964965
returnRE2::FullMatch(str, re.regex_);
965966
}
966-
staticboolPartialMatch(absl::string_view str, constRE& re) {
967+
staticboolPartialMatch(std::string_view str, constRE& re) {
967968
returnRE2::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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24002400
#include"absl/strings/string_view.h"
24012401
namespacetesting {
24022402
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
2413-
#include<string_view>
24142409
namespacetesting {
24152410
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW0
2426-
#endif
2415+
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#defineGTEST_INTERNAL_HAS_COMPARE_LIB1

‎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(constchar* 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
voidConditionalPrintAsText(constchar* 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-
voidPrintStringTo(::std::string_view s, ostream* os) {
524+
voidPrintStringTo(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
Original file line numberDiff line numberDiff line change
@@ -6930,7 +6930,7 @@ void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
69306930
std::vector<char*> positional_args;
69316931
std::vector<absl::UnrecognizedFlag> unrecognized_flags;
69326932
absl::ParseAbseilFlagsOnly(*argc, argv, positional_args, unrecognized_flags);
6933-
absl::flat_hash_set<absl::string_view> unrecognized;
6933+
absl::flat_hash_set<std::string_view> unrecognized;
69346934
for (constauto& flag : unrecognized_flags) {
69356935
unrecognized.insert(flag.flag_name);
69366936
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include<memory>
4646
#include<ostream>
4747
#include<string>
48+
#include<string_view>
4849
#include<type_traits>
4950

5051
#include"gtest/gtest-printers.h"
@@ -543,9 +544,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
543544
Matcher(constchar* s); // NOLINT
544545
};
545546

546-
#if GTEST_INTERNAL_HAS_STRING_VIEW
547547
// The following two specializations allow the user to write str
548-
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
548+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string_view
549549
// matcher is expected.
550550
template <>
551551
classGTEST_API_[[nodiscard]] Matcher<const internal::StringView&>
@@ -569,7 +569,7 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
569569
// Allows the user to write "foo" instead of Eq("foo") sometimes.
570570
Matcher(constchar* s); // NOLINT
571571

572-
// Allows the user to pass absl::string_views or std::string_views directly.
572+
// Allows the user to pass std::string_views directly.
573573
Matcher(internal::StringView s); // NOLINT
574574
};
575575

@@ -596,10 +596,9 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
596596
// Allows the user to write "foo" instead of Eq("foo") sometimes.
597597
Matcher(constchar* s); // NOLINT
598598

599-
// Allows the user to pass absl::string_views or std::string_views directly.
599+
// Allows the user to pass std::string_views directly.
600600
Matcher(internal::StringView s); // NOLINT
601601
};
602-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
603602

604603
// Prints a matcher in a human-readable format.
605604
template <typename T>
@@ -812,9 +811,26 @@ class [[nodiscard]] ImplicitCastEqMatcher {
812811
StoredRhs stored_rhs_;
813812
};
814813

815-
template <typename T,
816-
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
817-
using StringLike = T;
814+
// Dummy function (never defined) whose return type evaluates to std::string if
815+
// the given type is a string-like type that can be converted to std::string,
816+
// either directly or through an intermediate std::string_view.
817+
template <classT>
818+
extern std::enable_if_t<std::is_constructible_v<std::string, T>, std::string>
819+
ResolveAsString(constvoid* /* preferred */);
820+
821+
#if GTEST_HAS_STD_WSTRING
822+
// Same as above, but for std::wstring. In cases where both conversions are
823+
// possible, this overload takes lower priority.
824+
template <classT>
825+
extern std::enable_if_t<std::is_constructible_v<std::wstring, T>, std::wstring>
826+
ResolveAsString(... /* fallback */);
827+
#endif
828+
829+
// Evaluates to the std::basic_string type that the given string-like type can
830+
// be converted to. Prefers std::string over std::wstring if both are possible.
831+
// Fails in a SFINAE-friendly way if no conversion was viable.
832+
template <typename T>
833+
using StringType = decltype(ResolveAsString<T>(nullptr));
818834

819835
// Implements polymorphic matchers MatchesRegex(regex) and
820836
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
@@ -824,12 +840,10 @@ class [[nodiscard]] MatchesRegexMatcher {
824840
MatchesRegexMatcher(constRE* regex, bool full_match)
825841
: regex_(regex), full_match_(full_match) {}
826842

827-
#if GTEST_INTERNAL_HAS_STRING_VIEW
828843
boolMatchAndExplain(const internal::StringView& s,
829844
MatchResultListener* listener) const {
830845
returnMatchAndExplain(std::string(s), listener);
831846
}
832-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
833847

834848
// Accepts pointer types, particularly:
835849
// const char*
@@ -844,7 +858,7 @@ class [[nodiscard]] MatchesRegexMatcher {
844858
// Matches anything that can convert to std::string.
845859
//
846860
// This is a template, not just a plain function with const std::string&,
847-
// because absl::string_view has some interfering non-explicit constructors.
861+
// because std::string_view has some interfering non-explicit constructors.
848862
template <classMatcheeStringType>
849863
boolMatchAndExplain(const MatcheeStringType& s,
850864
MatchResultListener* /* listener */) const {
@@ -877,9 +891,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
877891
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
878892
}
879893
template <typename T = std::string>
880-
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
881-
const internal::StringLike<T>& regex) {
882-
returnMatchesRegex(newinternal::RE(std::string(regex)));
894+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
895+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
896+
MatchesRegex(const T& regex) {
897+
returnMatchesRegex(newinternal::RE(internal::StringType<T>(regex)));
883898
}
884899

885900
// Matches a string that contains regular expression 'regex'.
@@ -889,9 +904,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
889904
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
890905
}
891906
template <typename T = std::string>
892-
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
893-
const internal::StringLike<T>& regex) {
894-
returnContainsRegex(newinternal::RE(std::string(regex)));
907+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
908+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
909+
ContainsRegex(const T& regex) {
910+
returnContainsRegex(newinternal::RE(internal::StringType<T>(regex)));
895911
}
896912

897913
// Creates a polymorphic matcher that matches anything equal to x.

‎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
structConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
staticvoidPrintValue(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_voidPrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_voidPrintStringTo(std::string_view s, ::std::ostream* os);
708706
inlinevoidPrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inlinevoidPrintTo(::std::string_view s, ::std::ostream* os) {
709+
inlinevoidPrintTo(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
inlinevoidPrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inlinevoidPrintTo(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
returnContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
returnContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(constchar* regex) {
6772
returnContainsRegex(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-
#defineGTEST_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+
#defineGTEST_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
#defineGTEST_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
classGTEST_API_[[nodiscard]]RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(constchar* 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(constchar* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(constRE& other) : RE(other.pattern()) {}
960961

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

963-
staticboolFullMatch(absl::string_view str, constRE& re) {
964+
staticboolFullMatch(std::string_view str, constRE& re) {
964965
returnRE2::FullMatch(str, re.regex_);
965966
}
966-
staticboolPartialMatch(absl::string_view str, constRE& re) {
967+
staticboolPartialMatch(std::string_view str, constRE& re) {
967968
returnRE2::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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24002400
#include"absl/strings/string_view.h"
24012401
namespacetesting {
24022402
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
2413-
#include<string_view>
24142409
namespacetesting {
24152410
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW0
2426-
#endif
2415+
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#defineGTEST_INTERNAL_HAS_COMPARE_LIB1

‎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(constchar* 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
voidConditionalPrintAsText(constchar* 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-
voidPrintStringTo(::std::string_view s, ostream* os) {
524+
voidPrintStringTo(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
Original file line numberDiff line numberDiff line change
@@ -6930,7 +6930,7 @@ void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
69306930
std::vector<char*> positional_args;
69316931
std::vector<absl::UnrecognizedFlag> unrecognized_flags;
69326932
absl::ParseAbseilFlagsOnly(*argc, argv, positional_args, unrecognized_flags);
6933-
absl::flat_hash_set<absl::string_view> unrecognized;
6933+
absl::flat_hash_set<std::string_view> unrecognized;
69346934
for (constauto& flag : unrecognized_flags) {
69356935
unrecognized.insert(flag.flag_name);
69366936
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include<memory>
4646
#include<ostream>
4747
#include<string>
48+
#include<string_view>
4849
#include<type_traits>
4950

5051
#include"gtest/gtest-printers.h"
@@ -543,9 +544,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
543544
Matcher(constchar* s); // NOLINT
544545
};
545546

546-
#if GTEST_INTERNAL_HAS_STRING_VIEW
547547
// The following two specializations allow the user to write str
548-
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
548+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string_view
549549
// matcher is expected.
550550
template <>
551551
classGTEST_API_[[nodiscard]] Matcher<const internal::StringView&>
@@ -569,7 +569,7 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
569569
// Allows the user to write "foo" instead of Eq("foo") sometimes.
570570
Matcher(constchar* s); // NOLINT
571571

572-
// Allows the user to pass absl::string_views or std::string_views directly.
572+
// Allows the user to pass std::string_views directly.
573573
Matcher(internal::StringView s); // NOLINT
574574
};
575575

@@ -596,10 +596,9 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
596596
// Allows the user to write "foo" instead of Eq("foo") sometimes.
597597
Matcher(constchar* s); // NOLINT
598598

599-
// Allows the user to pass absl::string_views or std::string_views directly.
599+
// Allows the user to pass std::string_views directly.
600600
Matcher(internal::StringView s); // NOLINT
601601
};
602-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
603602

604603
// Prints a matcher in a human-readable format.
605604
template <typename T>
@@ -812,9 +811,26 @@ class [[nodiscard]] ImplicitCastEqMatcher {
812811
StoredRhs stored_rhs_;
813812
};
814813

815-
template <typename T,
816-
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
817-
using StringLike = T;
814+
// Dummy function (never defined) whose return type evaluates to std::string if
815+
// the given type is a string-like type that can be converted to std::string,
816+
// either directly or through an intermediate std::string_view.
817+
template <classT>
818+
extern std::enable_if_t<std::is_constructible_v<std::string, T>, std::string>
819+
ResolveAsString(constvoid* /* preferred */);
820+
821+
#if GTEST_HAS_STD_WSTRING
822+
// Same as above, but for std::wstring. In cases where both conversions are
823+
// possible, this overload takes lower priority.
824+
template <classT>
825+
extern std::enable_if_t<std::is_constructible_v<std::wstring, T>, std::wstring>
826+
ResolveAsString(... /* fallback */);
827+
#endif
828+
829+
// Evaluates to the std::basic_string type that the given string-like type can
830+
// be converted to. Prefers std::string over std::wstring if both are possible.
831+
// Fails in a SFINAE-friendly way if no conversion was viable.
832+
template <typename T>
833+
using StringType = decltype(ResolveAsString<T>(nullptr));
818834

819835
// Implements polymorphic matchers MatchesRegex(regex) and
820836
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
@@ -824,12 +840,10 @@ class [[nodiscard]] MatchesRegexMatcher {
824840
MatchesRegexMatcher(constRE* regex, bool full_match)
825841
: regex_(regex), full_match_(full_match) {}
826842

827-
#if GTEST_INTERNAL_HAS_STRING_VIEW
828843
boolMatchAndExplain(const internal::StringView& s,
829844
MatchResultListener* listener) const {
830845
returnMatchAndExplain(std::string(s), listener);
831846
}
832-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
833847

834848
// Accepts pointer types, particularly:
835849
// const char*
@@ -844,7 +858,7 @@ class [[nodiscard]] MatchesRegexMatcher {
844858
// Matches anything that can convert to std::string.
845859
//
846860
// This is a template, not just a plain function with const std::string&,
847-
// because absl::string_view has some interfering non-explicit constructors.
861+
// because std::string_view has some interfering non-explicit constructors.
848862
template <classMatcheeStringType>
849863
boolMatchAndExplain(const MatcheeStringType& s,
850864
MatchResultListener* /* listener */) const {
@@ -877,9 +891,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
877891
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
878892
}
879893
template <typename T = std::string>
880-
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
881-
const internal::StringLike<T>& regex) {
882-
returnMatchesRegex(newinternal::RE(std::string(regex)));
894+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
895+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
896+
MatchesRegex(const T& regex) {
897+
returnMatchesRegex(newinternal::RE(internal::StringType<T>(regex)));
883898
}
884899

885900
// Matches a string that contains regular expression 'regex'.
@@ -889,9 +904,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
889904
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
890905
}
891906
template <typename T = std::string>
892-
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
893-
const internal::StringLike<T>& regex) {
894-
returnContainsRegex(newinternal::RE(std::string(regex)));
907+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
908+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
909+
ContainsRegex(const T& regex) {
910+
returnContainsRegex(newinternal::RE(internal::StringType<T>(regex)));
895911
}
896912

897913
// Creates a polymorphic matcher that matches anything equal to x.

‎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
structConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
staticvoidPrintValue(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_voidPrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_voidPrintStringTo(std::string_view s, ::std::ostream* os);
708706
inlinevoidPrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inlinevoidPrintTo(::std::string_view s, ::std::ostream* os) {
709+
inlinevoidPrintTo(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
inlinevoidPrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inlinevoidPrintTo(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
returnContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
returnContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(constchar* regex) {
6772
returnContainsRegex(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-
#defineGTEST_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+
#defineGTEST_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
#defineGTEST_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
classGTEST_API_[[nodiscard]]RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(constchar* 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(constchar* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(constRE& other) : RE(other.pattern()) {}
960961

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

963-
staticboolFullMatch(absl::string_view str, constRE& re) {
964+
staticboolFullMatch(std::string_view str, constRE& re) {
964965
returnRE2::FullMatch(str, re.regex_);
965966
}
966-
staticboolPartialMatch(absl::string_view str, constRE& re) {
967+
staticboolPartialMatch(std::string_view str, constRE& re) {
967968
returnRE2::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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24002400
#include"absl/strings/string_view.h"
24012401
namespacetesting {
24022402
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
2413-
#include<string_view>
24142409
namespacetesting {
24152410
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW0
2426-
#endif
2415+
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#defineGTEST_INTERNAL_HAS_COMPARE_LIB1

‎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(constchar* 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
voidConditionalPrintAsText(constchar* 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-
voidPrintStringTo(::std::string_view s, ostream* os) {
524+
voidPrintStringTo(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
Original file line numberDiff line numberDiff line change
@@ -6930,7 +6930,7 @@ void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
69306930
std::vector<char*> positional_args;
69316931
std::vector<absl::UnrecognizedFlag> unrecognized_flags;
69326932
absl::ParseAbseilFlagsOnly(*argc, argv, positional_args, unrecognized_flags);
6933-
absl::flat_hash_set<absl::string_view> unrecognized;
6933+
absl::flat_hash_set<std::string_view> unrecognized;
69346934
for (constauto& flag : unrecognized_flags) {
69356935
unrecognized.insert(flag.flag_name);
69366936
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
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
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include<memory>
4646
#include<ostream>
4747
#include<string>
48+
#include<string_view>
4849
#include<type_traits>
4950

5051
#include"gtest/gtest-printers.h"
@@ -543,9 +544,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
543544
Matcher(constchar* s); // NOLINT
544545
};
545546

546-
#if GTEST_INTERNAL_HAS_STRING_VIEW
547547
// The following two specializations allow the user to write str
548-
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
548+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string_view
549549
// matcher is expected.
550550
template <>
551551
classGTEST_API_[[nodiscard]] Matcher<const internal::StringView&>
@@ -569,7 +569,7 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
569569
// Allows the user to write "foo" instead of Eq("foo") sometimes.
570570
Matcher(constchar* s); // NOLINT
571571

572-
// Allows the user to pass absl::string_views or std::string_views directly.
572+
// Allows the user to pass std::string_views directly.
573573
Matcher(internal::StringView s); // NOLINT
574574
};
575575

@@ -596,10 +596,9 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
596596
// Allows the user to write "foo" instead of Eq("foo") sometimes.
597597
Matcher(constchar* s); // NOLINT
598598

599-
// Allows the user to pass absl::string_views or std::string_views directly.
599+
// Allows the user to pass std::string_views directly.
600600
Matcher(internal::StringView s); // NOLINT
601601
};
602-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
603602

604603
// Prints a matcher in a human-readable format.
605604
template <typename T>
@@ -812,9 +811,26 @@ class [[nodiscard]] ImplicitCastEqMatcher {
812811
StoredRhs stored_rhs_;
813812
};
814813

815-
template <typename T,
816-
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
817-
using StringLike = T;
814+
// Dummy function (never defined) whose return type evaluates to std::string if
815+
// the given type is a string-like type that can be converted to std::string,
816+
// either directly or through an intermediate std::string_view.
817+
template <classT>
818+
extern std::enable_if_t<std::is_constructible_v<std::string, T>, std::string>
819+
ResolveAsString(constvoid* /* preferred */);
820+
821+
#if GTEST_HAS_STD_WSTRING
822+
// Same as above, but for std::wstring. In cases where both conversions are
823+
// possible, this overload takes lower priority.
824+
template <classT>
825+
extern std::enable_if_t<std::is_constructible_v<std::wstring, T>, std::wstring>
826+
ResolveAsString(... /* fallback */);
827+
#endif
828+
829+
// Evaluates to the std::basic_string type that the given string-like type can
830+
// be converted to. Prefers std::string over std::wstring if both are possible.
831+
// Fails in a SFINAE-friendly way if no conversion was viable.
832+
template <typename T>
833+
using StringType = decltype(ResolveAsString<T>(nullptr));
818834

819835
// Implements polymorphic matchers MatchesRegex(regex) and
820836
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
@@ -824,12 +840,10 @@ class [[nodiscard]] MatchesRegexMatcher {
824840
MatchesRegexMatcher(constRE* regex, bool full_match)
825841
: regex_(regex), full_match_(full_match) {}
826842

827-
#if GTEST_INTERNAL_HAS_STRING_VIEW
828843
boolMatchAndExplain(const internal::StringView& s,
829844
MatchResultListener* listener) const {
830845
returnMatchAndExplain(std::string(s), listener);
831846
}
832-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
833847

834848
// Accepts pointer types, particularly:
835849
// const char*
@@ -844,7 +858,7 @@ class [[nodiscard]] MatchesRegexMatcher {
844858
// Matches anything that can convert to std::string.
845859
//
846860
// This is a template, not just a plain function with const std::string&,
847-
// because absl::string_view has some interfering non-explicit constructors.
861+
// because std::string_view has some interfering non-explicit constructors.
848862
template <classMatcheeStringType>
849863
boolMatchAndExplain(const MatcheeStringType& s,
850864
MatchResultListener* /* listener */) const {
@@ -877,9 +891,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
877891
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
878892
}
879893
template <typename T = std::string>
880-
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
881-
const internal::StringLike<T>& regex) {
882-
returnMatchesRegex(newinternal::RE(std::string(regex)));
894+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
895+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
896+
MatchesRegex(const T& regex) {
897+
returnMatchesRegex(newinternal::RE(internal::StringType<T>(regex)));
883898
}
884899

885900
// Matches a string that contains regular expression 'regex'.
@@ -889,9 +904,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
889904
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
890905
}
891906
template <typename T = std::string>
892-
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
893-
const internal::StringLike<T>& regex) {
894-
returnContainsRegex(newinternal::RE(std::string(regex)));
907+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
908+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
909+
ContainsRegex(const T& regex) {
910+
returnContainsRegex(newinternal::RE(internal::StringType<T>(regex)));
895911
}
896912

897913
// Creates a polymorphic matcher that matches anything equal to x.

‎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
structConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
staticvoidPrintValue(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_voidPrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_voidPrintStringTo(std::string_view s, ::std::ostream* os);
708706
inlinevoidPrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inlinevoidPrintTo(::std::string_view s, ::std::ostream* os) {
709+
inlinevoidPrintTo(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
inlinevoidPrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inlinevoidPrintTo(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
returnContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
returnContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(constchar* regex) {
6772
returnContainsRegex(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-
#defineGTEST_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+
#defineGTEST_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
#defineGTEST_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
classGTEST_API_[[nodiscard]]RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(constchar* 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(constchar* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(constRE& other) : RE(other.pattern()) {}
960961

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

963-
staticboolFullMatch(absl::string_view str, constRE& re) {
964+
staticboolFullMatch(std::string_view str, constRE& re) {
964965
returnRE2::FullMatch(str, re.regex_);
965966
}
966-
staticboolPartialMatch(absl::string_view str, constRE& re) {
967+
staticboolPartialMatch(std::string_view str, constRE& re) {
967968
returnRE2::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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24002400
#include"absl/strings/string_view.h"
24012401
namespacetesting {
24022402
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
2413-
#include<string_view>
24142409
namespacetesting {
24152410
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW0
2426-
#endif
2415+
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#defineGTEST_INTERNAL_HAS_COMPARE_LIB1

‎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(constchar* 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
voidConditionalPrintAsText(constchar* 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-
voidPrintStringTo(::std::string_view s, ostream* os) {
524+
voidPrintStringTo(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
Original file line numberDiff line numberDiff line change
@@ -6930,7 +6930,7 @@ void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
69306930
std::vector<char*> positional_args;
69316931
std::vector<absl::UnrecognizedFlag> unrecognized_flags;
69326932
absl::ParseAbseilFlagsOnly(*argc, argv, positional_args, unrecognized_flags);
6933-
absl::flat_hash_set<absl::string_view> unrecognized;
6933+
absl::flat_hash_set<std::string_view> unrecognized;
69346934
for (constauto& flag : unrecognized_flags) {
69356935
unrecognized.insert(flag.flag_name);
69366936
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include<memory>
4646
#include<ostream>
4747
#include<string>
48+
#include<string_view>
4849
#include<type_traits>
4950

5051
#include"gtest/gtest-printers.h"
@@ -543,9 +544,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
543544
Matcher(constchar* s); // NOLINT
544545
};
545546

546-
#if GTEST_INTERNAL_HAS_STRING_VIEW
547547
// The following two specializations allow the user to write str
548-
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
548+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string_view
549549
// matcher is expected.
550550
template <>
551551
classGTEST_API_[[nodiscard]] Matcher<const internal::StringView&>
@@ -569,7 +569,7 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
569569
// Allows the user to write "foo" instead of Eq("foo") sometimes.
570570
Matcher(constchar* s); // NOLINT
571571

572-
// Allows the user to pass absl::string_views or std::string_views directly.
572+
// Allows the user to pass std::string_views directly.
573573
Matcher(internal::StringView s); // NOLINT
574574
};
575575

@@ -596,10 +596,9 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
596596
// Allows the user to write "foo" instead of Eq("foo") sometimes.
597597
Matcher(constchar* s); // NOLINT
598598

599-
// Allows the user to pass absl::string_views or std::string_views directly.
599+
// Allows the user to pass std::string_views directly.
600600
Matcher(internal::StringView s); // NOLINT
601601
};
602-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
603602

604603
// Prints a matcher in a human-readable format.
605604
template <typename T>
@@ -812,9 +811,26 @@ class [[nodiscard]] ImplicitCastEqMatcher {
812811
StoredRhs stored_rhs_;
813812
};
814813

815-
template <typename T,
816-
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
817-
using StringLike = T;
814+
// Dummy function (never defined) whose return type evaluates to std::string if
815+
// the given type is a string-like type that can be converted to std::string,
816+
// either directly or through an intermediate std::string_view.
817+
template <classT>
818+
extern std::enable_if_t<std::is_constructible_v<std::string, T>, std::string>
819+
ResolveAsString(constvoid* /* preferred */);
820+
821+
#if GTEST_HAS_STD_WSTRING
822+
// Same as above, but for std::wstring. In cases where both conversions are
823+
// possible, this overload takes lower priority.
824+
template <classT>
825+
extern std::enable_if_t<std::is_constructible_v<std::wstring, T>, std::wstring>
826+
ResolveAsString(... /* fallback */);
827+
#endif
828+
829+
// Evaluates to the std::basic_string type that the given string-like type can
830+
// be converted to. Prefers std::string over std::wstring if both are possible.
831+
// Fails in a SFINAE-friendly way if no conversion was viable.
832+
template <typename T>
833+
using StringType = decltype(ResolveAsString<T>(nullptr));
818834

819835
// Implements polymorphic matchers MatchesRegex(regex) and
820836
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
@@ -824,12 +840,10 @@ class [[nodiscard]] MatchesRegexMatcher {
824840
MatchesRegexMatcher(constRE* regex, bool full_match)
825841
: regex_(regex), full_match_(full_match) {}
826842

827-
#if GTEST_INTERNAL_HAS_STRING_VIEW
828843
boolMatchAndExplain(const internal::StringView& s,
829844
MatchResultListener* listener) const {
830845
returnMatchAndExplain(std::string(s), listener);
831846
}
832-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
833847

834848
// Accepts pointer types, particularly:
835849
// const char*
@@ -844,7 +858,7 @@ class [[nodiscard]] MatchesRegexMatcher {
844858
// Matches anything that can convert to std::string.
845859
//
846860
// This is a template, not just a plain function with const std::string&,
847-
// because absl::string_view has some interfering non-explicit constructors.
861+
// because std::string_view has some interfering non-explicit constructors.
848862
template <classMatcheeStringType>
849863
boolMatchAndExplain(const MatcheeStringType& s,
850864
MatchResultListener* /* listener */) const {
@@ -877,9 +891,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
877891
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
878892
}
879893
template <typename T = std::string>
880-
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
881-
const internal::StringLike<T>& regex) {
882-
returnMatchesRegex(newinternal::RE(std::string(regex)));
894+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
895+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
896+
MatchesRegex(const T& regex) {
897+
returnMatchesRegex(newinternal::RE(internal::StringType<T>(regex)));
883898
}
884899

885900
// Matches a string that contains regular expression 'regex'.
@@ -889,9 +904,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
889904
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
890905
}
891906
template <typename T = std::string>
892-
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
893-
const internal::StringLike<T>& regex) {
894-
returnContainsRegex(newinternal::RE(std::string(regex)));
907+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
908+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
909+
ContainsRegex(const T& regex) {
910+
returnContainsRegex(newinternal::RE(internal::StringType<T>(regex)));
895911
}
896912

897913
// Creates a polymorphic matcher that matches anything equal to x.

‎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
structConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
staticvoidPrintValue(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_voidPrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_voidPrintStringTo(std::string_view s, ::std::ostream* os);
708706
inlinevoidPrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inlinevoidPrintTo(::std::string_view s, ::std::ostream* os) {
709+
inlinevoidPrintTo(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
inlinevoidPrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inlinevoidPrintTo(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
returnContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
returnContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(constchar* regex) {
6772
returnContainsRegex(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-
#defineGTEST_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+
#defineGTEST_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
#defineGTEST_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
classGTEST_API_[[nodiscard]]RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(constchar* 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(constchar* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(constRE& other) : RE(other.pattern()) {}
960961

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

963-
staticboolFullMatch(absl::string_view str, constRE& re) {
964+
staticboolFullMatch(std::string_view str, constRE& re) {
964965
returnRE2::FullMatch(str, re.regex_);
965966
}
966-
staticboolPartialMatch(absl::string_view str, constRE& re) {
967+
staticboolPartialMatch(std::string_view str, constRE& re) {
967968
returnRE2::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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24002400
#include"absl/strings/string_view.h"
24012401
namespacetesting {
24022402
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
2413-
#include<string_view>
24142409
namespacetesting {
24152410
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW0
2426-
#endif
2415+
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#defineGTEST_INTERNAL_HAS_COMPARE_LIB1

‎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(constchar* 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
voidConditionalPrintAsText(constchar* 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-
voidPrintStringTo(::std::string_view s, ostream* os) {
524+
voidPrintStringTo(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
Original file line numberDiff line numberDiff line change
@@ -6930,7 +6930,7 @@ void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
69306930
std::vector<char*> positional_args;
69316931
std::vector<absl::UnrecognizedFlag> unrecognized_flags;
69326932
absl::ParseAbseilFlagsOnly(*argc, argv, positional_args, unrecognized_flags);
6933-
absl::flat_hash_set<absl::string_view> unrecognized;
6933+
absl::flat_hash_set<std::string_view> unrecognized;
69346934
for (constauto& flag : unrecognized_flags) {
69356935
unrecognized.insert(flag.flag_name);
69366936
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include<memory>
4646
#include<ostream>
4747
#include<string>
48+
#include<string_view>
4849
#include<type_traits>
4950

5051
#include"gtest/gtest-printers.h"
@@ -543,9 +544,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
543544
Matcher(constchar* s); // NOLINT
544545
};
545546

546-
#if GTEST_INTERNAL_HAS_STRING_VIEW
547547
// The following two specializations allow the user to write str
548-
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
548+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string_view
549549
// matcher is expected.
550550
template <>
551551
classGTEST_API_[[nodiscard]] Matcher<const internal::StringView&>
@@ -569,7 +569,7 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
569569
// Allows the user to write "foo" instead of Eq("foo") sometimes.
570570
Matcher(constchar* s); // NOLINT
571571

572-
// Allows the user to pass absl::string_views or std::string_views directly.
572+
// Allows the user to pass std::string_views directly.
573573
Matcher(internal::StringView s); // NOLINT
574574
};
575575

@@ -596,10 +596,9 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
596596
// Allows the user to write "foo" instead of Eq("foo") sometimes.
597597
Matcher(constchar* s); // NOLINT
598598

599-
// Allows the user to pass absl::string_views or std::string_views directly.
599+
// Allows the user to pass std::string_views directly.
600600
Matcher(internal::StringView s); // NOLINT
601601
};
602-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
603602

604603
// Prints a matcher in a human-readable format.
605604
template <typename T>
@@ -812,9 +811,26 @@ class [[nodiscard]] ImplicitCastEqMatcher {
812811
StoredRhs stored_rhs_;
813812
};
814813

815-
template <typename T,
816-
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
817-
using StringLike = T;
814+
// Dummy function (never defined) whose return type evaluates to std::string if
815+
// the given type is a string-like type that can be converted to std::string,
816+
// either directly or through an intermediate std::string_view.
817+
template <classT>
818+
extern std::enable_if_t<std::is_constructible_v<std::string, T>, std::string>
819+
ResolveAsString(constvoid* /* preferred */);
820+
821+
#if GTEST_HAS_STD_WSTRING
822+
// Same as above, but for std::wstring. In cases where both conversions are
823+
// possible, this overload takes lower priority.
824+
template <classT>
825+
extern std::enable_if_t<std::is_constructible_v<std::wstring, T>, std::wstring>
826+
ResolveAsString(... /* fallback */);
827+
#endif
828+
829+
// Evaluates to the std::basic_string type that the given string-like type can
830+
// be converted to. Prefers std::string over std::wstring if both are possible.
831+
// Fails in a SFINAE-friendly way if no conversion was viable.
832+
template <typename T>
833+
using StringType = decltype(ResolveAsString<T>(nullptr));
818834

819835
// Implements polymorphic matchers MatchesRegex(regex) and
820836
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
@@ -824,12 +840,10 @@ class [[nodiscard]] MatchesRegexMatcher {
824840
MatchesRegexMatcher(constRE* regex, bool full_match)
825841
: regex_(regex), full_match_(full_match) {}
826842

827-
#if GTEST_INTERNAL_HAS_STRING_VIEW
828843
boolMatchAndExplain(const internal::StringView& s,
829844
MatchResultListener* listener) const {
830845
returnMatchAndExplain(std::string(s), listener);
831846
}
832-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
833847

834848
// Accepts pointer types, particularly:
835849
// const char*
@@ -844,7 +858,7 @@ class [[nodiscard]] MatchesRegexMatcher {
844858
// Matches anything that can convert to std::string.
845859
//
846860
// This is a template, not just a plain function with const std::string&,
847-
// because absl::string_view has some interfering non-explicit constructors.
861+
// because std::string_view has some interfering non-explicit constructors.
848862
template <classMatcheeStringType>
849863
boolMatchAndExplain(const MatcheeStringType& s,
850864
MatchResultListener* /* listener */) const {
@@ -877,9 +891,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
877891
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
878892
}
879893
template <typename T = std::string>
880-
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
881-
const internal::StringLike<T>& regex) {
882-
returnMatchesRegex(newinternal::RE(std::string(regex)));
894+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
895+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
896+
MatchesRegex(const T& regex) {
897+
returnMatchesRegex(newinternal::RE(internal::StringType<T>(regex)));
883898
}
884899

885900
// Matches a string that contains regular expression 'regex'.
@@ -889,9 +904,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
889904
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
890905
}
891906
template <typename T = std::string>
892-
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
893-
const internal::StringLike<T>& regex) {
894-
returnContainsRegex(newinternal::RE(std::string(regex)));
907+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
908+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
909+
ContainsRegex(const T& regex) {
910+
returnContainsRegex(newinternal::RE(internal::StringType<T>(regex)));
895911
}
896912

897913
// Creates a polymorphic matcher that matches anything equal to x.

‎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
structConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
staticvoidPrintValue(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_voidPrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_voidPrintStringTo(std::string_view s, ::std::ostream* os);
708706
inlinevoidPrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inlinevoidPrintTo(::std::string_view s, ::std::ostream* os) {
709+
inlinevoidPrintTo(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
inlinevoidPrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inlinevoidPrintTo(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
returnContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
returnContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(constchar* regex) {
6772
returnContainsRegex(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-
#defineGTEST_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+
#defineGTEST_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
#defineGTEST_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
classGTEST_API_[[nodiscard]]RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(constchar* 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(constchar* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(constRE& other) : RE(other.pattern()) {}
960961

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

963-
staticboolFullMatch(absl::string_view str, constRE& re) {
964+
staticboolFullMatch(std::string_view str, constRE& re) {
964965
returnRE2::FullMatch(str, re.regex_);
965966
}
966-
staticboolPartialMatch(absl::string_view str, constRE& re) {
967+
staticboolPartialMatch(std::string_view str, constRE& re) {
967968
returnRE2::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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24002400
#include"absl/strings/string_view.h"
24012401
namespacetesting {
24022402
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
2413-
#include<string_view>
24142409
namespacetesting {
24152410
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW0
2426-
#endif
2415+
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#defineGTEST_INTERNAL_HAS_COMPARE_LIB1

‎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(constchar* 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
voidConditionalPrintAsText(constchar* 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-
voidPrintStringTo(::std::string_view s, ostream* os) {
524+
voidPrintStringTo(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
Original file line numberDiff line numberDiff line change
@@ -6930,7 +6930,7 @@ void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
69306930
std::vector<char*> positional_args;
69316931
std::vector<absl::UnrecognizedFlag> unrecognized_flags;
69326932
absl::ParseAbseilFlagsOnly(*argc, argv, positional_args, unrecognized_flags);
6933-
absl::flat_hash_set<absl::string_view> unrecognized;
6933+
absl::flat_hash_set<std::string_view> unrecognized;
69346934
for (constauto& flag : unrecognized_flags) {
69356935
unrecognized.insert(flag.flag_name);
69366936
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
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
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include<memory>
4646
#include<ostream>
4747
#include<string>
48+
#include<string_view>
4849
#include<type_traits>
4950

5051
#include"gtest/gtest-printers.h"
@@ -543,9 +544,8 @@ Matcher<std::string> : public internal::MatcherBase<std::string> {
543544
Matcher(constchar* s); // NOLINT
544545
};
545546

546-
#if GTEST_INTERNAL_HAS_STRING_VIEW
547547
// The following two specializations allow the user to write str
548-
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
548+
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string_view
549549
// matcher is expected.
550550
template <>
551551
classGTEST_API_[[nodiscard]] Matcher<const internal::StringView&>
@@ -569,7 +569,7 @@ class GTEST_API_ [[nodiscard]] Matcher<const internal::StringView&>
569569
// Allows the user to write "foo" instead of Eq("foo") sometimes.
570570
Matcher(constchar* s); // NOLINT
571571

572-
// Allows the user to pass absl::string_views or std::string_views directly.
572+
// Allows the user to pass std::string_views directly.
573573
Matcher(internal::StringView s); // NOLINT
574574
};
575575

@@ -596,10 +596,9 @@ class GTEST_API_ [[nodiscard]] Matcher<internal::StringView>
596596
// Allows the user to write "foo" instead of Eq("foo") sometimes.
597597
Matcher(constchar* s); // NOLINT
598598

599-
// Allows the user to pass absl::string_views or std::string_views directly.
599+
// Allows the user to pass std::string_views directly.
600600
Matcher(internal::StringView s); // NOLINT
601601
};
602-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
603602

604603
// Prints a matcher in a human-readable format.
605604
template <typename T>
@@ -812,9 +811,26 @@ class [[nodiscard]] ImplicitCastEqMatcher {
812811
StoredRhs stored_rhs_;
813812
};
814813

815-
template <typename T,
816-
typename = std::enable_if_t<std::is_constructible_v<std::string, T>>>
817-
using StringLike = T;
814+
// Dummy function (never defined) whose return type evaluates to std::string if
815+
// the given type is a string-like type that can be converted to std::string,
816+
// either directly or through an intermediate std::string_view.
817+
template <classT>
818+
extern std::enable_if_t<std::is_constructible_v<std::string, T>, std::string>
819+
ResolveAsString(constvoid* /* preferred */);
820+
821+
#if GTEST_HAS_STD_WSTRING
822+
// Same as above, but for std::wstring. In cases where both conversions are
823+
// possible, this overload takes lower priority.
824+
template <classT>
825+
extern std::enable_if_t<std::is_constructible_v<std::wstring, T>, std::wstring>
826+
ResolveAsString(... /* fallback */);
827+
#endif
828+
829+
// Evaluates to the std::basic_string type that the given string-like type can
830+
// be converted to. Prefers std::string over std::wstring if both are possible.
831+
// Fails in a SFINAE-friendly way if no conversion was viable.
832+
template <typename T>
833+
using StringType = decltype(ResolveAsString<T>(nullptr));
818834

819835
// Implements polymorphic matchers MatchesRegex(regex) and
820836
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
@@ -824,12 +840,10 @@ class [[nodiscard]] MatchesRegexMatcher {
824840
MatchesRegexMatcher(constRE* regex, bool full_match)
825841
: regex_(regex), full_match_(full_match) {}
826842

827-
#if GTEST_INTERNAL_HAS_STRING_VIEW
828843
boolMatchAndExplain(const internal::StringView& s,
829844
MatchResultListener* listener) const {
830845
returnMatchAndExplain(std::string(s), listener);
831846
}
832-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
833847

834848
// Accepts pointer types, particularly:
835849
// const char*
@@ -844,7 +858,7 @@ class [[nodiscard]] MatchesRegexMatcher {
844858
// Matches anything that can convert to std::string.
845859
//
846860
// This is a template, not just a plain function with const std::string&,
847-
// because absl::string_view has some interfering non-explicit constructors.
861+
// because std::string_view has some interfering non-explicit constructors.
848862
template <classMatcheeStringType>
849863
boolMatchAndExplain(const MatcheeStringType& s,
850864
MatchResultListener* /* listener */) const {
@@ -877,9 +891,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
877891
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
878892
}
879893
template <typename T = std::string>
880-
PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
881-
const internal::StringLike<T>& regex) {
882-
returnMatchesRegex(newinternal::RE(std::string(regex)));
894+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
895+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
896+
MatchesRegex(const T& regex) {
897+
returnMatchesRegex(newinternal::RE(internal::StringType<T>(regex)));
883898
}
884899

885900
// Matches a string that contains regular expression 'regex'.
@@ -889,9 +904,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
889904
returnMakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
890905
}
891906
template <typename T = std::string>
892-
PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
893-
const internal::StringLike<T>& regex) {
894-
returnContainsRegex(newinternal::RE(std::string(regex)));
907+
std::enable_if_t<std::is_constructible_v<internal::RE, internal::StringType<T>>,
908+
PolymorphicMatcher<internal::MatchesRegexMatcher>>
909+
ContainsRegex(const T& regex) {
910+
returnContainsRegex(newinternal::RE(internal::StringType<T>(regex)));
895911
}
896912

897913
// Creates a polymorphic matcher that matches anything equal to x.

‎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
structConvertibleToStringViewPrinter {
294-
#if GTEST_INTERNAL_HAS_STRING_VIEW
295294
staticvoidPrintValue(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_voidPrintStringTo(::std::string_view s, ::std::ostream* os);
704+
// Overloads for ::std::string and std::string_view
705+
GTEST_API_voidPrintStringTo(std::string_view s, ::std::ostream* os);
708706
inlinevoidPrintTo(const ::std::string& s, ::std::ostream* os) {
709707
PrintStringTo(s, os);
710708
}
711-
inlinevoidPrintTo(::std::string_view s, ::std::ostream* os) {
709+
inlinevoidPrintTo(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
inlinevoidPrintTo(internal::StringView sp, ::std::ostream* os) {
762759
PrintStringTo(sp, os);
763760
}
764-
#endif// GTEST_INTERNAL_HAS_STRING_VIEW
765761

766762
inlinevoidPrintTo(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
returnContainsRegex(regex.pattern());
6566
}
67+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
68+
std::string_view regex) {
69+
returnContainsRegex(regex);
70+
}
6671
inline Matcher<const ::std::string&> MakeDeathTestMatcher(constchar* regex) {
6772
returnContainsRegex(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-
#defineGTEST_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+
#defineGTEST_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
#defineGTEST_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
classGTEST_API_[[nodiscard]]RE {
955956
public:
956-
RE(absl::string_view regex) : regex_(regex) {} // NOLINT
957-
RE(constchar* 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(constchar* regex) : RE(std::string_view(regex)) {} // NOLINT
959+
RE(const std::string& regex) : RE(std::string_view(regex)) {} // NOLINT
959960
RE(constRE& other) : RE(other.pattern()) {}
960961

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

963-
staticboolFullMatch(absl::string_view str, constRE& re) {
964+
staticboolFullMatch(std::string_view str, constRE& re) {
964965
returnRE2::FullMatch(str, re.regex_);
965966
}
966-
staticboolPartialMatch(absl::string_view str, constRE& re) {
967+
staticboolPartialMatch(std::string_view str, constRE& re) {
967968
returnRE2::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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24002400
#include"absl/strings/string_view.h"
24012401
namespacetesting {
24022402
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
2413-
#include<string_view>
24142409
namespacetesting {
24152410
namespaceinternal {
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-
#defineGTEST_INTERNAL_HAS_STRING_VIEW0
2426-
#endif
2415+
#defineGTEST_INTERNAL_HAS_STRING_VIEW1
24272416

24282417
#if defined(__cpp_lib_three_way_comparison)
24292418
#defineGTEST_INTERNAL_HAS_COMPARE_LIB1

‎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(constchar* 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
voidConditionalPrintAsText(constchar* 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-
voidPrintStringTo(::std::string_view s, ostream* os) {
524+
voidPrintStringTo(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
Original file line numberDiff line numberDiff line change
@@ -6930,7 +6930,7 @@ void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
69306930
std::vector<char*> positional_args;
69316931
std::vector<absl::UnrecognizedFlag> unrecognized_flags;
69326932
absl::ParseAbseilFlagsOnly(*argc, argv, positional_args, unrecognized_flags);
6933-
absl::flat_hash_set<absl::string_view> unrecognized;
6933+
absl::flat_hash_set<std::string_view> unrecognized;
69346934
for (constauto& flag : unrecognized_flags) {
69356935
unrecognized.insert(flag.flag_name);
69366936
}

0 commit comments

Comments
 (0)