Skip to content

Commit 37fcf80

Browse files
nodejs-github-botjuanarbol
authored andcommitted
deps: update googletest to 56efe3983185e3f37e43415d1afa97e3860f187f
PR-URL: #61605 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 84f69d0 commit 37fcf80

2 files changed

Lines changed: 29 additions & 11 deletions

File tree

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

Lines changed: 19 additions & 1 deletion
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 <cstddef>
4344
#include <functional>
4445
#include <memory>
4546
#include <ostream>
@@ -485,6 +486,15 @@ class [[nodiscard]] Matcher : public internal::MatcherBase<T> {
485486
// Implicit constructor here allows people to write
486487
// EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
487488
Matcher(T value); // NOLINT
489+
490+
// Implicit constructor here allows people to write
491+
// EXPECT_THAT(foo, nullptr) instead of EXPECT_THAT(foo, IsNull()) for smart
492+
// pointer types.
493+
//
494+
// The second argument is needed to avoid capturing literal '0'.
495+
template <typename U>
496+
Matcher(U, // NOLINT
497+
std::enable_if_t<std::is_same_v<U, std::nullptr_t>>* = nullptr);
488498
};
489499

490500
// The following two specializations allow the user to write str
@@ -895,13 +905,21 @@ inline internal::EqMatcher<T> Eq(T x) {
895905
return internal::EqMatcher<T>(x);
896906
}
897907

898-
// Constructs a Matcher<T> from a 'value' of type T. The constructed
908+
// Constructs a Matcher<T> from a 'value' of type T. The constructed
899909
// matcher matches any value that's equal to 'value'.
900910
template <typename T>
901911
Matcher<T>::Matcher(T value) {
902912
*this = Eq(value);
903913
}
904914

915+
// Constructs a Matcher<T> from nullptr. The constructed matcher matches any
916+
// value that is equal to nullptr.
917+
template <typename T>
918+
template <typename U>
919+
Matcher<T>::Matcher(U, std::enable_if_t<std::is_same_v<U, std::nullptr_t>>*) {
920+
*this = Eq(nullptr);
921+
}
922+
905923
// Creates a monomorphic matcher that matches anything with type Lhs
906924
// and equal to rhs. A user may need to use this instead of Eq(...)
907925
// in order to resolve an overloading ambiguity.

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ typedef GTestMutexLock MutexLock;
14831483
// without knowing its type.
14841484
class [[nodiscard]] ThreadLocalValueHolderBase {
14851485
public:
1486-
virtual ~ThreadLocalValueHolderBase() {}
1486+
virtual ~ThreadLocalValueHolderBase() = default;
14871487
};
14881488

14891489
// Provides a way for a thread to send notifications to a ThreadLocal
@@ -1497,8 +1497,8 @@ class [[nodiscard]] ThreadLocalBase {
14971497
virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0;
14981498

14991499
protected:
1500-
ThreadLocalBase() {}
1501-
virtual ~ThreadLocalBase() {}
1500+
ThreadLocalBase() = default;
1501+
virtual ~ThreadLocalBase() = default;
15021502

15031503
private:
15041504
ThreadLocalBase(const ThreadLocalBase&) = delete;
@@ -1527,7 +1527,7 @@ class GTEST_API_ [[nodiscard]] ThreadWithParamBase {
15271527
protected:
15281528
class Runnable {
15291529
public:
1530-
virtual ~Runnable() {}
1530+
virtual ~Runnable() = default;
15311531
virtual void Run() = 0;
15321532
};
15331533

@@ -1546,14 +1546,14 @@ class [[nodiscard]] ThreadWithParam : public ThreadWithParamBase {
15461546

15471547
ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
15481548
: ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {}
1549-
virtual ~ThreadWithParam() {}
1549+
~ThreadWithParam() override {}
15501550

15511551
private:
15521552
class RunnableImpl : public Runnable {
15531553
public:
15541554
RunnableImpl(UserThreadFunc* func, T param) : func_(func), param_(param) {}
1555-
virtual ~RunnableImpl() {}
1556-
virtual void Run() { func_(param_); }
1555+
~RunnableImpl() override {}
1556+
void Run() override { func_(param_); }
15571557

15581558
private:
15591559
UserThreadFunc* const func_;
@@ -1636,8 +1636,8 @@ class [[nodiscard]] ThreadLocal : public ThreadLocalBase {
16361636

16371637
class ValueHolderFactory {
16381638
public:
1639-
ValueHolderFactory() {}
1640-
virtual ~ValueHolderFactory() {}
1639+
ValueHolderFactory() = default;
1640+
virtual ~ValueHolderFactory() = default;
16411641
virtual ValueHolder* MakeNewHolder() const = 0;
16421642

16431643
private:
@@ -1647,7 +1647,7 @@ class [[nodiscard]] ThreadLocal : public ThreadLocalBase {
16471647

16481648
class DefaultValueHolderFactory : public ValueHolderFactory {
16491649
public:
1650-
DefaultValueHolderFactory() {}
1650+
DefaultValueHolderFactory() = default;
16511651
ValueHolder* MakeNewHolder() const override { return new ValueHolder(); }
16521652

16531653
private:

0 commit comments

Comments
 (0)