Skip to content

Commit 4c74465

Browse files
nodejs-github-botCeres6
authored andcommitted
deps: update googletest to ec4fed9
PR-URL: nodejs#48538 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent a8ff8c4 commit 4c74465

25 files changed

+696
-586
lines changed

deps/googletest/include/gtest/gtest-assertion-result.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class GTEST_API_ AssertionResult {
181181
// assertion's expectation). When nothing has been streamed into the
182182
// object, returns an empty string.
183183
const char* message() const {
184-
return message_.get() != nullptr ? message_->c_str() : "";
184+
return message_ != nullptr ? message_->c_str() : "";
185185
}
186186
// Deprecated; please use message() instead.
187187
const char* failure_message() const { return message(); }
@@ -204,7 +204,7 @@ class GTEST_API_ AssertionResult {
204204
private:
205205
// Appends the contents of message to message_.
206206
void AppendMessage(const Message& a_message) {
207-
if (message_.get() == nullptr) message_.reset(new ::std::string);
207+
if (message_ == nullptr) message_ = ::std::make_unique<::std::string>();
208208
message_->append(a_message.GetString().c_str());
209209
}
210210

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ GTEST_DECLARE_string_(death_test_style);
5151

5252
namespace testing {
5353

54-
#if GTEST_HAS_DEATH_TEST
54+
#ifdef GTEST_HAS_DEATH_TEST
5555

5656
namespace internal {
5757

@@ -203,7 +203,7 @@ class GTEST_API_ ExitedWithCode {
203203
const int exit_code_;
204204
};
205205

206-
#if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
206+
#if !defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_FUCHSIA)
207207
// Tests that an exit code describes an exit due to termination by a
208208
// given signal.
209209
class GTEST_API_ KilledBySignal {
@@ -328,7 +328,7 @@ class GTEST_API_ KilledBySignal {
328328
// death tests are supported; otherwise they just issue a warning. This is
329329
// useful when you are combining death test assertions with normal test
330330
// assertions in one test.
331-
#if GTEST_HAS_DEATH_TEST
331+
#ifdef GTEST_HAS_DEATH_TEST
332332
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
333333
EXPECT_DEATH(statement, regex)
334334
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \

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

+22-55
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
4141

4242
#include <atomic>
43+
#include <functional>
4344
#include <memory>
4445
#include <ostream>
4546
#include <string>
@@ -106,13 +107,13 @@ class MatchResultListener {
106107
MatchResultListener& operator=(const MatchResultListener&) = delete;
107108
};
108109

109-
inline MatchResultListener::~MatchResultListener() {}
110+
inline MatchResultListener::~MatchResultListener() = default;
110111

111112
// An instance of a subclass of this knows how to describe itself as a
112113
// matcher.
113114
class GTEST_API_ MatcherDescriberInterface {
114115
public:
115-
virtual ~MatcherDescriberInterface() {}
116+
virtual ~MatcherDescriberInterface() = default;
116117

117118
// Describes this matcher to an ostream. The function should print
118119
// a verb phrase that describes the property a value matching this
@@ -178,43 +179,6 @@ class MatcherInterface : public MatcherDescriberInterface {
178179

179180
namespace internal {
180181

181-
struct AnyEq {
182-
template <typename A, typename B>
183-
bool operator()(const A& a, const B& b) const {
184-
return a == b;
185-
}
186-
};
187-
struct AnyNe {
188-
template <typename A, typename B>
189-
bool operator()(const A& a, const B& b) const {
190-
return a != b;
191-
}
192-
};
193-
struct AnyLt {
194-
template <typename A, typename B>
195-
bool operator()(const A& a, const B& b) const {
196-
return a < b;
197-
}
198-
};
199-
struct AnyGt {
200-
template <typename A, typename B>
201-
bool operator()(const A& a, const B& b) const {
202-
return a > b;
203-
}
204-
};
205-
struct AnyLe {
206-
template <typename A, typename B>
207-
bool operator()(const A& a, const B& b) const {
208-
return a <= b;
209-
}
210-
};
211-
struct AnyGe {
212-
template <typename A, typename B>
213-
bool operator()(const A& a, const B& b) const {
214-
return a >= b;
215-
}
216-
};
217-
218182
// A match result listener that ignores the explanation.
219183
class DummyMatchResultListener : public MatchResultListener {
220184
public:
@@ -530,7 +494,7 @@ template <>
530494
class GTEST_API_ Matcher<const std::string&>
531495
: public internal::MatcherBase<const std::string&> {
532496
public:
533-
Matcher() {}
497+
Matcher() = default;
534498

535499
explicit Matcher(const MatcherInterface<const std::string&>* impl)
536500
: internal::MatcherBase<const std::string&>(impl) {}
@@ -552,7 +516,7 @@ template <>
552516
class GTEST_API_ Matcher<std::string>
553517
: public internal::MatcherBase<std::string> {
554518
public:
555-
Matcher() {}
519+
Matcher() = default;
556520

557521
explicit Matcher(const MatcherInterface<const std::string&>* impl)
558522
: internal::MatcherBase<std::string>(impl) {}
@@ -580,7 +544,7 @@ template <>
580544
class GTEST_API_ Matcher<const internal::StringView&>
581545
: public internal::MatcherBase<const internal::StringView&> {
582546
public:
583-
Matcher() {}
547+
Matcher() = default;
584548

585549
explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
586550
: internal::MatcherBase<const internal::StringView&>(impl) {}
@@ -606,7 +570,7 @@ template <>
606570
class GTEST_API_ Matcher<internal::StringView>
607571
: public internal::MatcherBase<internal::StringView> {
608572
public:
609-
Matcher() {}
573+
Matcher() = default;
610574

611575
explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
612576
: internal::MatcherBase<internal::StringView>(impl) {}
@@ -758,50 +722,53 @@ class ComparisonBase {
758722
};
759723

760724
template <typename Rhs>
761-
class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
725+
class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>> {
762726
public:
763727
explicit EqMatcher(const Rhs& rhs)
764-
: ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) {}
728+
: ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>>(rhs) {}
765729
static const char* Desc() { return "is equal to"; }
766730
static const char* NegatedDesc() { return "isn't equal to"; }
767731
};
768732
template <typename Rhs>
769-
class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
733+
class NeMatcher
734+
: public ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>> {
770735
public:
771736
explicit NeMatcher(const Rhs& rhs)
772-
: ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) {}
737+
: ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>>(rhs) {}
773738
static const char* Desc() { return "isn't equal to"; }
774739
static const char* NegatedDesc() { return "is equal to"; }
775740
};
776741
template <typename Rhs>
777-
class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
742+
class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>> {
778743
public:
779744
explicit LtMatcher(const Rhs& rhs)
780-
: ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) {}
745+
: ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>>(rhs) {}
781746
static const char* Desc() { return "is <"; }
782747
static const char* NegatedDesc() { return "isn't <"; }
783748
};
784749
template <typename Rhs>
785-
class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
750+
class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>> {
786751
public:
787752
explicit GtMatcher(const Rhs& rhs)
788-
: ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) {}
753+
: ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>>(rhs) {}
789754
static const char* Desc() { return "is >"; }
790755
static const char* NegatedDesc() { return "isn't >"; }
791756
};
792757
template <typename Rhs>
793-
class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
758+
class LeMatcher
759+
: public ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>> {
794760
public:
795761
explicit LeMatcher(const Rhs& rhs)
796-
: ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) {}
762+
: ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>>(rhs) {}
797763
static const char* Desc() { return "is <="; }
798764
static const char* NegatedDesc() { return "isn't <="; }
799765
};
800766
template <typename Rhs>
801-
class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
767+
class GeMatcher
768+
: public ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>> {
802769
public:
803770
explicit GeMatcher(const Rhs& rhs)
804-
: ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) {}
771+
: ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>>(rhs) {}
805772
static const char* Desc() { return "is >="; }
806773
static const char* NegatedDesc() { return "isn't >="; }
807774
};

deps/googletest/include/gtest/gtest-param-test.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,8 @@ internal::ParamConverterGenerator<T> ConvertGenerator(
449449

450450
#define TEST_P(test_suite_name, test_name) \
451451
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
452-
: public test_suite_name, private ::testing::internal::GTestNonCopyable {\
452+
: public test_suite_name, \
453+
private ::testing::internal::GTestNonCopyable { \
453454
public: \
454455
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
455456
void TestBody() override; \

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

+20-12
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,13 @@ struct StreamPrinter {
206206
// Don't accept member pointers here. We'd print them via implicit
207207
// conversion to bool, which isn't useful.
208208
typename = typename std::enable_if<
209-
!std::is_member_pointer<T>::value>::type,
210-
// Only accept types for which we can find a streaming operator via
211-
// ADL (possibly involving implicit conversions).
212-
typename = decltype(std::declval<std::ostream&>()
213-
<< std::declval<const T&>())>
214-
static void PrintValue(const T& value, ::std::ostream* os) {
209+
!std::is_member_pointer<T>::value>::type>
210+
// Only accept types for which we can find a streaming operator via
211+
// ADL (possibly involving implicit conversions).
212+
// (Use SFINAE via return type, because it seems GCC < 12 doesn't handle name
213+
// lookup properly when we do it in the template parameter list.)
214+
static auto PrintValue(const T& value, ::std::ostream* os)
215+
-> decltype((void)(*os << value)) {
215216
// Call streaming operator found by ADL, possibly with implicit conversions
216217
// of the arguments.
217218
*os << value;
@@ -306,9 +307,10 @@ template <typename T>
306307
void PrintWithFallback(const T& value, ::std::ostream* os) {
307308
using Printer = typename FindFirstPrinter<
308309
T, void, ContainerPrinter, FunctionPointerPrinter, PointerPrinter,
310+
ProtobufPrinter,
309311
internal_stream_operator_without_lexical_name_lookup::StreamPrinter,
310-
ProtobufPrinter, ConvertibleToIntegerPrinter,
311-
ConvertibleToStringViewPrinter, RawBytesPrinter, FallbackPrinter>::type;
312+
ConvertibleToIntegerPrinter, ConvertibleToStringViewPrinter,
313+
RawBytesPrinter, FallbackPrinter>::type;
312314
Printer::PrintValue(value, os);
313315
}
314316

@@ -529,7 +531,10 @@ int AppropriateResolution(FloatType val) {
529531
} else if (val >= 0.0001) {
530532
mulfor6 = 1e9;
531533
}
532-
if (static_cast<int32_t>(val * mulfor6 + 0.5) / mulfor6 == val) return 6;
534+
if (static_cast<float>(static_cast<int32_t>(val * mulfor6 + 0.5)) /
535+
mulfor6 ==
536+
val)
537+
return 6;
533538
} else if (val < 1e10) {
534539
FloatType divfor6 = 1.0;
535540
if (val >= 1e9) { // 1,000,000,000 to 9,999,999,999
@@ -541,7 +546,10 @@ int AppropriateResolution(FloatType val) {
541546
} else if (val >= 1e6) { // 1,000,000 to 9,999,999
542547
divfor6 = 10;
543548
}
544-
if (static_cast<int32_t>(val / divfor6 + 0.5) * divfor6 == val) return 6;
549+
if (static_cast<float>(static_cast<int32_t>(val / divfor6 + 0.5)) *
550+
divfor6 ==
551+
val)
552+
return 6;
545553
}
546554
return full;
547555
}
@@ -850,7 +858,7 @@ class UniversalPrinter<Variant<T...>> {
850858
public:
851859
static void Print(const Variant<T...>& value, ::std::ostream* os) {
852860
*os << '(';
853-
#if GTEST_HAS_ABSL
861+
#ifdef GTEST_HAS_ABSL
854862
absl::visit(Visitor{os, value.index()}, value);
855863
#else
856864
std::visit(Visitor{os, value.index()}, value);
@@ -996,7 +1004,7 @@ template <>
9961004
class UniversalTersePrinter<char*> : public UniversalTersePrinter<const char*> {
9971005
};
9981006

999-
#ifdef __cpp_char8_t
1007+
#ifdef __cpp_lib_char8_t
10001008
template <>
10011009
class UniversalTersePrinter<const char8_t*> {
10021010
public:

deps/googletest/include/gtest/gtest-test-part.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
133133
// virtual.
134134
class GTEST_API_ TestPartResultArray {
135135
public:
136-
TestPartResultArray() {}
136+
TestPartResultArray() = default;
137137

138138
// Appends the given TestPartResult to the array.
139139
void Append(const TestPartResult& result);
@@ -154,7 +154,7 @@ class GTEST_API_ TestPartResultArray {
154154
// This interface knows how to report a test part result.
155155
class GTEST_API_ TestPartResultReporterInterface {
156156
public:
157-
virtual ~TestPartResultReporterInterface() {}
157+
virtual ~TestPartResultReporterInterface() = default;
158158

159159
virtual void ReportTestPartResult(const TestPartResult& result) = 0;
160160
};

deps/googletest/include/gtest/gtest-typed-test.h

+17-17
Original file line numberDiff line numberDiff line change
@@ -267,28 +267,28 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
267267
TYPED_TEST_SUITE_P
268268
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
269269

270-
#define TYPED_TEST_P(SuiteName, TestName) \
271-
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
272-
template <typename gtest_TypeParam_> \
273-
class TestName : public SuiteName<gtest_TypeParam_> { \
274-
private: \
275-
typedef SuiteName<gtest_TypeParam_> TestFixture; \
276-
typedef gtest_TypeParam_ TypeParam; \
277-
void TestBody() override; \
278-
}; \
279-
static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
280-
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
281-
__FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
282-
GTEST_STRINGIFY_(TestName)); \
283-
} \
284-
template <typename gtest_TypeParam_> \
285-
void GTEST_SUITE_NAMESPACE_( \
270+
#define TYPED_TEST_P(SuiteName, TestName) \
271+
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
272+
template <typename gtest_TypeParam_> \
273+
class TestName : public SuiteName<gtest_TypeParam_> { \
274+
private: \
275+
typedef SuiteName<gtest_TypeParam_> TestFixture; \
276+
typedef gtest_TypeParam_ TypeParam; \
277+
void TestBody() override; \
278+
}; \
279+
static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
280+
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
281+
__FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
282+
GTEST_STRINGIFY_(TestName)); \
283+
} \
284+
template <typename gtest_TypeParam_> \
285+
void GTEST_SUITE_NAMESPACE_( \
286286
SuiteName)::TestName<gtest_TypeParam_>::TestBody()
287287

288288
// Note: this won't work correctly if the trailing arguments are macros.
289289
#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \
290290
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
291-
typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \
291+
typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \
292292
} \
293293
static const char* const GTEST_REGISTERED_TEST_NAMES_( \
294294
SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \

0 commit comments

Comments
 (0)