Googletest export
Applied fixes for ClangTidy modernize-use-override and modernize-use-using. PiperOrigin-RevId: 223800219
This commit is contained in:
committed by
Gennadiy Civil
parent
a42cdf2abd
commit
26743363be
@@ -379,7 +379,7 @@ typedef int MyGlobalFunction(bool, int);
|
||||
|
||||
class MyActionImpl : public ActionInterface<MyGlobalFunction> {
|
||||
public:
|
||||
virtual int Perform(const std::tuple<bool, int>& args) {
|
||||
int Perform(const std::tuple<bool, int>& args) override {
|
||||
return std::get<0>(args) ? std::get<1>(args) : 0;
|
||||
}
|
||||
};
|
||||
@@ -443,7 +443,7 @@ TEST(ActionTest, IsCopyable) {
|
||||
|
||||
class IsNotZero : public ActionInterface<bool(int)> { // NOLINT
|
||||
public:
|
||||
virtual bool Perform(const std::tuple<int>& arg) {
|
||||
bool Perform(const std::tuple<int>& arg) override {
|
||||
return std::get<0>(arg) != 0;
|
||||
}
|
||||
};
|
||||
@@ -1087,7 +1087,7 @@ TEST(WithArgsTest, TenArgs) {
|
||||
// Tests using WithArgs with an action that is not Invoke().
|
||||
class SubtractAction : public ActionInterface<int(int, int)> {
|
||||
public:
|
||||
virtual int Perform(const std::tuple<int, int>& args) {
|
||||
int Perform(const std::tuple<int, int>& args) override {
|
||||
return std::get<0>(args) - std::get<1>(args);
|
||||
}
|
||||
};
|
||||
@@ -1155,8 +1155,8 @@ TEST(WithArgsTest, InnerActionWithConversion) {
|
||||
|
||||
class SetErrnoAndReturnTest : public testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() { errno = 0; }
|
||||
virtual void TearDown() { errno = 0; }
|
||||
void SetUp() override { errno = 0; }
|
||||
void TearDown() override { errno = 0; }
|
||||
};
|
||||
|
||||
TEST_F(SetErrnoAndReturnTest, Int) {
|
||||
|
||||
@@ -396,17 +396,17 @@ TEST(ExactlyTest, HasCorrectBounds) {
|
||||
class EvenCardinality : public CardinalityInterface {
|
||||
public:
|
||||
// Returns true iff call_count calls will satisfy this cardinality.
|
||||
virtual bool IsSatisfiedByCallCount(int call_count) const {
|
||||
bool IsSatisfiedByCallCount(int call_count) const override {
|
||||
return (call_count % 2 == 0);
|
||||
}
|
||||
|
||||
// Returns true iff call_count calls will saturate this cardinality.
|
||||
virtual bool IsSaturatedByCallCount(int /* call_count */) const {
|
||||
bool IsSaturatedByCallCount(int /* call_count */) const override {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Describes self to an ostream.
|
||||
virtual void DescribeTo(::std::ostream* ss) const {
|
||||
void DescribeTo(::std::ostream* ss) const override {
|
||||
*ss << "called even number of times";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -117,12 +117,11 @@ class GreaterThanMatcher : public MatcherInterface<int> {
|
||||
public:
|
||||
explicit GreaterThanMatcher(int rhs) : rhs_(rhs) {}
|
||||
|
||||
virtual void DescribeTo(::std::ostream* os) const {
|
||||
void DescribeTo(::std::ostream* os) const override {
|
||||
*os << "is greater than " << rhs_;
|
||||
}
|
||||
|
||||
virtual bool MatchAndExplain(int lhs,
|
||||
MatchResultListener* listener) const {
|
||||
bool MatchAndExplain(int lhs, MatchResultListener* listener) const override {
|
||||
const int diff = lhs - rhs_;
|
||||
if (diff > 0) {
|
||||
*listener << "which is " << diff << " more than " << rhs_;
|
||||
|
||||
@@ -379,11 +379,9 @@ TEST(ExpectTest, FailsNonfatallyOnFalse) {
|
||||
|
||||
class LogIsVisibleTest : public ::testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
original_verbose_ = GMOCK_FLAG(verbose);
|
||||
}
|
||||
void SetUp() override { original_verbose_ = GMOCK_FLAG(verbose); }
|
||||
|
||||
virtual void TearDown() { GMOCK_FLAG(verbose) = original_verbose_; }
|
||||
void TearDown() override { GMOCK_FLAG(verbose) = original_verbose_; }
|
||||
|
||||
std::string original_verbose_;
|
||||
};
|
||||
@@ -442,11 +440,11 @@ TEST(LogTest, NoStackTraceWhenStackFramesToSkipIsNegative) {
|
||||
}
|
||||
|
||||
struct MockStackTraceGetter : testing::internal::OsStackTraceGetterInterface {
|
||||
virtual std::string CurrentStackTrace(int max_depth, int skip_count) {
|
||||
std::string CurrentStackTrace(int max_depth, int skip_count) override {
|
||||
return (testing::Message() << max_depth << "::" << skip_count << "\n")
|
||||
.GetString();
|
||||
}
|
||||
virtual void UponLeavingGTest() {}
|
||||
void UponLeavingGTest() override {}
|
||||
};
|
||||
|
||||
// Tests that in opt mode, a positive stack_frames_to_skip argument is
|
||||
|
||||
@@ -162,12 +162,9 @@ class GreaterThanMatcher : public MatcherInterface<int> {
|
||||
public:
|
||||
explicit GreaterThanMatcher(int rhs) : rhs_(rhs) {}
|
||||
|
||||
virtual void DescribeTo(ostream* os) const {
|
||||
*os << "is > " << rhs_;
|
||||
}
|
||||
void DescribeTo(ostream* os) const override { *os << "is > " << rhs_; }
|
||||
|
||||
virtual bool MatchAndExplain(int lhs,
|
||||
MatchResultListener* listener) const {
|
||||
bool MatchAndExplain(int lhs, MatchResultListener* listener) const override {
|
||||
const int diff = lhs - rhs_;
|
||||
if (diff > 0) {
|
||||
*listener << "which is " << diff << " more than " << rhs_;
|
||||
@@ -257,14 +254,12 @@ TEST(MatchResultListenerTest, IsInterestedWorks) {
|
||||
// change.
|
||||
class EvenMatcherImpl : public MatcherInterface<int> {
|
||||
public:
|
||||
virtual bool MatchAndExplain(int x,
|
||||
MatchResultListener* /* listener */) const {
|
||||
bool MatchAndExplain(int x,
|
||||
MatchResultListener* /* listener */) const override {
|
||||
return x % 2 == 0;
|
||||
}
|
||||
|
||||
virtual void DescribeTo(ostream* os) const {
|
||||
*os << "is an even number";
|
||||
}
|
||||
void DescribeTo(ostream* os) const override { *os << "is an even number"; }
|
||||
|
||||
// We deliberately don't define DescribeNegationTo() and
|
||||
// ExplainMatchResultTo() here, to make sure the definition of these
|
||||
@@ -280,7 +275,7 @@ TEST(MatcherInterfaceTest, CanBeImplementedUsingPublishedAPI) {
|
||||
|
||||
class NewEvenMatcherImpl : public MatcherInterface<int> {
|
||||
public:
|
||||
virtual bool MatchAndExplain(int x, MatchResultListener* listener) const {
|
||||
bool MatchAndExplain(int x, MatchResultListener* listener) const override {
|
||||
const bool match = x % 2 == 0;
|
||||
// Verifies that we can stream to a listener directly.
|
||||
*listener << "value % " << 2;
|
||||
@@ -292,9 +287,7 @@ class NewEvenMatcherImpl : public MatcherInterface<int> {
|
||||
return match;
|
||||
}
|
||||
|
||||
virtual void DescribeTo(ostream* os) const {
|
||||
*os << "is an even number";
|
||||
}
|
||||
void DescribeTo(ostream* os) const override { *os << "is an even number"; }
|
||||
};
|
||||
|
||||
TEST(MatcherInterfaceTest, CanBeImplementedUsingNewAPI) {
|
||||
|
||||
@@ -1952,17 +1952,17 @@ TEST(DeletingMockEarlyTest, Failure2) {
|
||||
class EvenNumberCardinality : public CardinalityInterface {
|
||||
public:
|
||||
// Returns true iff call_count calls will satisfy this cardinality.
|
||||
virtual bool IsSatisfiedByCallCount(int call_count) const {
|
||||
bool IsSatisfiedByCallCount(int call_count) const override {
|
||||
return call_count % 2 == 0;
|
||||
}
|
||||
|
||||
// Returns true iff call_count calls will saturate this cardinality.
|
||||
virtual bool IsSaturatedByCallCount(int /* call_count */) const {
|
||||
bool IsSaturatedByCallCount(int /* call_count */) const override {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Describes self to an ostream.
|
||||
virtual void DescribeTo(::std::ostream* os) const {
|
||||
void DescribeTo(::std::ostream* os) const override {
|
||||
*os << "called even number of times";
|
||||
}
|
||||
};
|
||||
@@ -2023,7 +2023,9 @@ class VerboseFlagPreservingFixture : public testing::Test {
|
||||
VerboseFlagPreservingFixture()
|
||||
: saved_verbose_flag_(GMOCK_FLAG(verbose)) {}
|
||||
|
||||
~VerboseFlagPreservingFixture() { GMOCK_FLAG(verbose) = saved_verbose_flag_; }
|
||||
~VerboseFlagPreservingFixture() override {
|
||||
GMOCK_FLAG(verbose) = saved_verbose_flag_;
|
||||
}
|
||||
|
||||
private:
|
||||
const std::string saved_verbose_flag_;
|
||||
|
||||
Reference in New Issue
Block a user