Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion deps/googletest/include/gtest/gtest-matchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_

#include <atomic>
#include <cstddef>
#include <functional>
#include <memory>
#include <ostream>
Expand Down Expand Up @@ -485,6 +486,15 @@ class [[nodiscard]] Matcher : public internal::MatcherBase<T> {
// Implicit constructor here allows people to write
// EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
Matcher(T value); // NOLINT

// Implicit constructor here allows people to write
// EXPECT_THAT(foo, nullptr) instead of EXPECT_THAT(foo, IsNull()) for smart
// pointer types.
//
// The second argument is needed to avoid capturing literal '0'.
template <typename U>
Matcher(U, // NOLINT
std::enable_if_t<std::is_same_v<U, std::nullptr_t>>* = nullptr);
};

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

// Constructs a Matcher<T> from a 'value' of type T. The constructed
// Constructs a Matcher<T> from a 'value' of type T. The constructed
// matcher matches any value that's equal to 'value'.
template <typename T>
Matcher<T>::Matcher(T value) {
*this = Eq(value);
}

// Constructs a Matcher<T> from nullptr. The constructed matcher matches any
// value that is equal to nullptr.
template <typename T>
template <typename U>
Matcher<T>::Matcher(U, std::enable_if_t<std::is_same_v<U, std::nullptr_t>>*) {
*this = Eq(nullptr);
}

// Creates a monomorphic matcher that matches anything with type Lhs
// and equal to rhs. A user may need to use this instead of Eq(...)
// in order to resolve an overloading ambiguity.
Expand Down
20 changes: 10 additions & 10 deletions deps/googletest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ typedef GTestMutexLock MutexLock;
// without knowing its type.
class [[nodiscard]] ThreadLocalValueHolderBase {
public:
virtual ~ThreadLocalValueHolderBase() {}
virtual ~ThreadLocalValueHolderBase() = default;
};

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

protected:
ThreadLocalBase() {}
virtual ~ThreadLocalBase() {}
ThreadLocalBase() = default;
virtual ~ThreadLocalBase() = default;

private:
ThreadLocalBase(const ThreadLocalBase&) = delete;
Expand Down Expand Up @@ -1496,7 +1496,7 @@ class GTEST_API_ [[nodiscard]] ThreadWithParamBase {
protected:
class Runnable {
public:
virtual ~Runnable() {}
virtual ~Runnable() = default;
virtual void Run() = 0;
};

Expand All @@ -1515,14 +1515,14 @@ class [[nodiscard]] ThreadWithParam : public ThreadWithParamBase {

ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start)
: ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {}
virtual ~ThreadWithParam() {}
~ThreadWithParam() override {}

private:
class RunnableImpl : public Runnable {
public:
RunnableImpl(UserThreadFunc* func, T param) : func_(func), param_(param) {}
virtual ~RunnableImpl() {}
virtual void Run() { func_(param_); }
~RunnableImpl() override {}
void Run() override { func_(param_); }

private:
UserThreadFunc* const func_;
Expand Down Expand Up @@ -1605,8 +1605,8 @@ class [[nodiscard]] ThreadLocal : public ThreadLocalBase {

class ValueHolderFactory {
public:
ValueHolderFactory() {}
virtual ~ValueHolderFactory() {}
ValueHolderFactory() = default;
virtual ~ValueHolderFactory() = default;
virtual ValueHolder* MakeNewHolder() const = 0;

private:
Expand All @@ -1616,7 +1616,7 @@ class [[nodiscard]] ThreadLocal : public ThreadLocalBase {

class DefaultValueHolderFactory : public ValueHolderFactory {
public:
DefaultValueHolderFactory() {}
DefaultValueHolderFactory() = default;
ValueHolder* MakeNewHolder() const override { return new ValueHolder(); }

private:
Expand Down
Loading