Commit bf66935e authored by Derek Mauro's avatar Derek Mauro Committed by Copybara-Service
Browse files

Remove the legacy internal GTEST_DISALLOW_* macros

PiperOrigin-RevId: 443715444
Change-Id: I3ffd54b63d2728ae4a668ee7875c8c3c8188087c
parent b85864c6
......@@ -393,7 +393,8 @@ class DefaultValue {
private:
const T value_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(FixedValueProducer);
FixedValueProducer(const FixedValueProducer&) = delete;
FixedValueProducer& operator=(const FixedValueProducer&) = delete;
};
class FactoryValueProducer : public ValueProducer {
......@@ -404,7 +405,8 @@ class DefaultValue {
private:
const FactoryFunction factory_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(FactoryValueProducer);
FactoryValueProducer(const FactoryValueProducer&) = delete;
FactoryValueProducer& operator=(const FactoryValueProducer&) = delete;
};
static ValueProducer* producer_;
......@@ -478,7 +480,8 @@ class ActionInterface {
virtual Result Perform(const ArgumentTuple& args) = 0;
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface);
ActionInterface(const ActionInterface&) = delete;
ActionInterface& operator=(const ActionInterface&) = delete;
};
// An Action<F> is a copyable and IMMUTABLE (except by assignment)
......@@ -951,7 +954,8 @@ class ReturnAction {
R value_before_cast_;
Result value_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl);
Impl(const Impl&) = delete;
Impl& operator=(const Impl&) = delete;
};
// Partially specialize for ByMoveWrapper. This version of ReturnAction will
......
......@@ -313,7 +313,9 @@ class StringMatchResultListener : public MatchResultListener {
private:
::std::stringstream ss_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener);
StringMatchResultListener(const StringMatchResultListener&) = delete;
StringMatchResultListener& operator=(const StringMatchResultListener&) =
delete;
};
// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION
......@@ -2555,7 +2557,8 @@ class WhenSortedByMatcher {
const Comparator comparator_;
const Matcher<const ::std::vector<LhsValue>&> matcher_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl);
Impl(const Impl&) = delete;
Impl& operator=(const Impl&) = delete;
};
private:
......
......@@ -169,7 +169,8 @@ class GTEST_INTERNAL_EMPTY_BASE_CLASS NiceMock
}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
NiceMock(const NiceMock&) = delete;
NiceMock& operator=(const NiceMock&) = delete;
};
template <class MockClass>
......@@ -210,7 +211,8 @@ class GTEST_INTERNAL_EMPTY_BASE_CLASS NaggyMock
}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock);
NaggyMock(const NaggyMock&) = delete;
NaggyMock& operator=(const NaggyMock&) = delete;
};
template <class MockClass>
......@@ -251,7 +253,8 @@ class GTEST_INTERNAL_EMPTY_BASE_CLASS StrictMock
}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock);
StrictMock(const StrictMock&) = delete;
StrictMock& operator=(const StrictMock&) = delete;
};
#undef GTEST_INTERNAL_EMPTY_BASE_CLASS
......
......@@ -677,7 +677,8 @@ class GTEST_API_ InSequence {
private:
bool sequence_created_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT
InSequence(const InSequence&) = delete;
InSequence& operator=(const InSequence&) = delete;
} GTEST_ATTRIBUTE_UNUSED_;
namespace internal {
......@@ -1219,7 +1220,8 @@ class TypedExpectation : public ExpectationBase {
Matcher<const ArgumentTuple&> extra_matcher_;
Action<F> repeated_action_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation);
TypedExpectation(const TypedExpectation&) = delete;
TypedExpectation& operator=(const TypedExpectation&) = delete;
}; // class TypedExpectation
// A MockSpec object is used by ON_CALL() or EXPECT_CALL() for
......@@ -1392,7 +1394,8 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
Wrapper result_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder);
ActionResultHolder(const ActionResultHolder&) = delete;
ActionResultHolder& operator=(const ActionResultHolder&) = delete;
};
// Specialization for T = void.
......@@ -1425,7 +1428,8 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
private:
ActionResultHolder() {}
GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder);
ActionResultHolder(const ActionResultHolder&) = delete;
ActionResultHolder& operator=(const ActionResultHolder&) = delete;
};
template <typename F>
......
......@@ -86,7 +86,8 @@ class BetweenCardinalityImpl : public CardinalityInterface {
const int min_;
const int max_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(BetweenCardinalityImpl);
BetweenCardinalityImpl(const BetweenCardinalityImpl&) = delete;
BetweenCardinalityImpl& operator=(const BetweenCardinalityImpl&) = delete;
};
// Formats "n times" in a human-friendly way.
......
......@@ -869,7 +869,8 @@ class MockClass {
int(const std::unique_ptr<int>&, std::unique_ptr<int>));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockClass);
MockClass(const MockClass&) = delete;
MockClass& operator=(const MockClass&) = delete;
};
// Tests that DoDefault() returns the built-in default value for the
......
......@@ -54,7 +54,8 @@ class MockFoo {
MOCK_METHOD0(Bar, int()); // NOLINT
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
MockFoo(const MockFoo&) = delete;
MockFoo& operator=(const MockFoo&) = delete;
};
// Tests that Cardinality objects can be default constructed.
......
......@@ -202,7 +202,8 @@ class MockFoo : public FooInterface {
MOCK_METHOD(int, RefQualifiedOverloaded, (), (ref(&&), override));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
MockFoo(const MockFoo&) = delete;
MockFoo& operator=(const MockFoo&) = delete;
};
class LegacyMockFoo : public FooInterface {
......@@ -274,7 +275,8 @@ class LegacyMockFoo : public FooInterface {
int RefQualifiedOverloaded() && override { return 0; }
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockFoo);
LegacyMockFoo(const LegacyMockFoo&) = delete;
LegacyMockFoo& operator=(const LegacyMockFoo&) = delete;
};
#ifdef _MSC_VER
......@@ -492,7 +494,8 @@ class MockB {
MOCK_METHOD(void, DoB, ());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB);
MockB(const MockB&) = delete;
MockB& operator=(const MockB&) = delete;
};
class LegacyMockB {
......@@ -502,7 +505,8 @@ class LegacyMockB {
MOCK_METHOD0(DoB, void());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockB);
LegacyMockB(const LegacyMockB&) = delete;
LegacyMockB& operator=(const LegacyMockB&) = delete;
};
template <typename T>
......@@ -557,7 +561,8 @@ class MockStack : public StackInterface<T> {
MOCK_METHOD((std::map<int, int>), ReturnTypeWithComma, (int), (const));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStack);
MockStack(const MockStack&) = delete;
MockStack& operator=(const MockStack&) = delete;
};
template <typename T>
......@@ -575,7 +580,8 @@ class LegacyMockStack : public StackInterface<T> {
MOCK_CONST_METHOD1_T(ReturnTypeWithComma, std::map<int, int>(int)); // NOLINT
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockStack);
LegacyMockStack(const LegacyMockStack&) = delete;
LegacyMockStack& operator=(const LegacyMockStack&) = delete;
};
template <typename T>
......@@ -645,7 +651,8 @@ class MockStackWithCallType : public StackInterfaceWithCallType<T> {
(Calltype(STDMETHODCALLTYPE), override, const));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockStackWithCallType);
MockStackWithCallType(const MockStackWithCallType&) = delete;
MockStackWithCallType& operator=(const MockStackWithCallType&) = delete;
};
template <typename T>
......@@ -659,7 +666,9 @@ class LegacyMockStackWithCallType : public StackInterfaceWithCallType<T> {
MOCK_CONST_METHOD0_T_WITH_CALLTYPE(STDMETHODCALLTYPE, GetTop, const T&());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockStackWithCallType);
LegacyMockStackWithCallType(const LegacyMockStackWithCallType&) = delete;
LegacyMockStackWithCallType& operator=(const LegacyMockStackWithCallType&) =
delete;
};
template <typename T>
......@@ -709,7 +718,9 @@ class MockOverloadedOnArgNumber {
MY_MOCK_METHODS1_;
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnArgNumber);
MockOverloadedOnArgNumber(const MockOverloadedOnArgNumber&) = delete;
MockOverloadedOnArgNumber& operator=(const MockOverloadedOnArgNumber&) =
delete;
};
class LegacyMockOverloadedOnArgNumber {
......@@ -719,7 +730,10 @@ class LegacyMockOverloadedOnArgNumber {
LEGACY_MY_MOCK_METHODS1_;
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LegacyMockOverloadedOnArgNumber);
LegacyMockOverloadedOnArgNumber(const LegacyMockOverloadedOnArgNumber&) =
delete;
LegacyMockOverloadedOnArgNumber& operator=(
const LegacyMockOverloadedOnArgNumber&) = delete;
};
template <typename T>
......@@ -751,7 +765,9 @@ class MockOverloadedOnConstness {
MY_MOCK_METHODS2_;
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockOverloadedOnConstness);
MockOverloadedOnConstness(const MockOverloadedOnConstness&) = delete;
MockOverloadedOnConstness& operator=(const MockOverloadedOnConstness&) =
delete;
};
TEST(MockMethodOverloadedMockMethodTest, CanOverloadOnConstnessInMacroBody) {
......
......@@ -955,7 +955,8 @@ class AllArgsHelper {
MOCK_METHOD2(Helper, int(char x, int y));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(AllArgsHelper);
AllArgsHelper(const AllArgsHelper&) = delete;
AllArgsHelper& operator=(const AllArgsHelper&) = delete;
};
TEST(AllArgsTest, WorksInWithClause) {
......@@ -982,7 +983,8 @@ class OptionalMatchersHelper {
MOCK_METHOD2(Overloaded, int(char x, int y));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(OptionalMatchersHelper);
OptionalMatchersHelper(const OptionalMatchersHelper&) = delete;
OptionalMatchersHelper& operator=(const OptionalMatchersHelper&) = delete;
};
TEST(AllArgsTest, WorksWithoutMatchers) {
......
......@@ -579,7 +579,8 @@ class Base {
Base() {}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(Base);
Base(const Base&) = delete;
Base& operator=(const Base&) = delete;
};
class Derived : public Base {
......
......@@ -342,7 +342,8 @@ class Uncopyable {
private:
int value_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Uncopyable);
Uncopyable(const Uncopyable&) = delete;
Uncopyable& operator=(const Uncopyable&) = delete;
};
// Returns true if and only if x.value() is positive.
......@@ -2764,7 +2765,10 @@ class NativeArrayPassedAsPointerAndSize {
MOCK_METHOD(void, Helper, (int* array, int size));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(NativeArrayPassedAsPointerAndSize);
NativeArrayPassedAsPointerAndSize(const NativeArrayPassedAsPointerAndSize&) =
delete;
NativeArrayPassedAsPointerAndSize& operator=(
const NativeArrayPassedAsPointerAndSize&) = delete;
};
TEST(ElementsAreTest, WorksWithNativeArrayPassedAsPointerAndSize) {
......
......@@ -106,7 +106,8 @@ class NotCopyable {
private:
int value_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(NotCopyable);
NotCopyable(const NotCopyable&) = delete;
NotCopyable& operator=(const NotCopyable&) = delete;
};
TEST(ByRefTest, AllowsNotCopyableConstValueInMatchers) {
......
......@@ -45,7 +45,8 @@ class Mock {
MOCK_METHOD0(DoThis, void());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock);
Mock(const Mock&) = delete;
Mock& operator=(const Mock&) = delete;
};
namespace testing {
......@@ -93,7 +94,8 @@ class MockFoo : public Foo {
MOCK_METHOD0(ReturnNonDefaultConstructible, NotDefaultConstructible());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
MockFoo(const MockFoo&) = delete;
MockFoo& operator=(const MockFoo&) = delete;
};
class MockBar {
......@@ -117,7 +119,8 @@ class MockBar {
private:
std::string str_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockBar);
MockBar(const MockBar&) = delete;
MockBar& operator=(const MockBar&) = delete;
};
class MockBaz {
......
......@@ -150,7 +150,8 @@ class MockA {
MOCK_METHOD2(ReturnInt, int(int x, int y));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockA);
MockA(const MockA&) = delete;
MockA& operator=(const MockA&) = delete;
};
class MockB {
......@@ -161,7 +162,8 @@ class MockB {
MOCK_METHOD1(DoB, int(int n)); // NOLINT
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockB);
MockB(const MockB&) = delete;
MockB& operator=(const MockB&) = delete;
};
class ReferenceHoldingMock {
......@@ -171,7 +173,8 @@ class ReferenceHoldingMock {
MOCK_METHOD1(AcceptReference, void(std::shared_ptr<MockA>*));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(ReferenceHoldingMock);
ReferenceHoldingMock(const ReferenceHoldingMock&) = delete;
ReferenceHoldingMock& operator=(const ReferenceHoldingMock&) = delete;
};
// Tests that EXPECT_CALL and ON_CALL compile in a presence of macro
......@@ -193,7 +196,8 @@ class MockCC : public CC {
MOCK_METHOD0(Method, int());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockCC);
MockCC(const MockCC&) = delete;
MockCC& operator=(const MockCC&) = delete;
};
// Tests that a method with expanded name compiles.
......@@ -1894,7 +1898,8 @@ class MockC {
MOCK_METHOD0(NonVoidMethod, int()); // NOLINT
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockC);
MockC(const MockC&) = delete;
MockC& operator=(const MockC&) = delete;
};
class VerboseFlagPreservingFixture : public testing::Test {
......@@ -1909,7 +1914,9 @@ class VerboseFlagPreservingFixture : public testing::Test {
private:
const std::string saved_verbose_flag_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(VerboseFlagPreservingFixture);
VerboseFlagPreservingFixture(const VerboseFlagPreservingFixture&) = delete;
VerboseFlagPreservingFixture& operator=(const VerboseFlagPreservingFixture&) =
delete;
};
#if GTEST_HAS_STREAM_REDIRECTION
......@@ -2129,7 +2136,8 @@ class LogTestHelper {
MOCK_METHOD1(Foo, PrintMeNot(PrintMeNot));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(LogTestHelper);
LogTestHelper(const LogTestHelper&) = delete;
LogTestHelper& operator=(const LogTestHelper&) = delete;
};
class GMockLogTest : public VerboseFlagPreservingFixture {
......
......@@ -51,7 +51,8 @@ class MockFoo : public FooInterface {
MOCK_METHOD0(DoThis, void());
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
MockFoo(const MockFoo&) = delete;
MockFoo& operator=(const MockFoo&) = delete;
};
TEST(LeakTest, LeakedMockWithExpectCallCausesFailureWhenLeakCheckingIsEnabled) {
......
......@@ -221,7 +221,8 @@ class Mock : public Interface {
MOCK_METHOD1(VoidFromVector, void(const std::vector<int>& v));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock);
Mock(const Mock&) = delete;
Mock& operator=(const Mock&) = delete;
};
class InvokeHelper {
......
......@@ -62,7 +62,8 @@ class MockFoo {
MOCK_METHOD2(Bar3, void(int x, int y));
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
MockFoo(const MockFoo&) = delete;
MockFoo& operator=(const MockFoo&) = delete;
};
class GMockOutputTest : public testing::Test {
......
......@@ -102,7 +102,8 @@ class MatchResultListener {
private:
::std::ostream* const stream_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
MatchResultListener(const MatchResultListener&) = delete;
MatchResultListener& operator=(const MatchResultListener&) = delete;
};
inline MatchResultListener::~MatchResultListener() {}
......@@ -220,7 +221,8 @@ class DummyMatchResultListener : public MatchResultListener {
DummyMatchResultListener() : MatchResultListener(nullptr) {}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
DummyMatchResultListener(const DummyMatchResultListener&) = delete;
DummyMatchResultListener& operator=(const DummyMatchResultListener&) = delete;
};
// A match result listener that forwards the explanation to a given
......@@ -232,7 +234,9 @@ class StreamMatchResultListener : public MatchResultListener {
: MatchResultListener(os) {}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
StreamMatchResultListener(const StreamMatchResultListener&) = delete;
StreamMatchResultListener& operator=(const StreamMatchResultListener&) =
delete;
};
struct SharedPayloadBase {
......
......@@ -429,8 +429,11 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
return 0; \
} \
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
test_name)); \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
(const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
const GTEST_TEST_CLASS_NAME_(test_suite_name, \
test_name) &) = delete; /* NOLINT */ \
}; \
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
test_name)::gtest_registering_dummy_ = \
......
......@@ -85,7 +85,10 @@ class GTEST_API_ ScopedFakeTestPartResultReporter
TestPartResultReporterInterface* old_reporter_;
TestPartResultArray* const result_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
ScopedFakeTestPartResultReporter(const ScopedFakeTestPartResultReporter&) =
delete;
ScopedFakeTestPartResultReporter& operator=(
const ScopedFakeTestPartResultReporter&) = delete;
};
namespace internal {
......@@ -107,7 +110,8 @@ class GTEST_API_ SingleFailureChecker {
const TestPartResult::Type type_;
const std::string substr_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
SingleFailureChecker(const SingleFailureChecker&) = delete;
SingleFailureChecker& operator=(const SingleFailureChecker&) = delete;
};
} // namespace internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment