Rollback: Moves boilerplate disabling copy constructor/assignment from GoogleTest's TEST_P macro into a header file to avoid triggering warnings in user code.
PiperOrigin-RevId: 477566426 Change-Id: Ia417e295d839f43be6e61a5699457866108f2a01
This commit is contained in:
parent
19387c9dd5
commit
d1a0039b97
@ -409,7 +409,7 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
|
|||||||
|
|
||||||
#define TEST_P(test_suite_name, test_name) \
|
#define TEST_P(test_suite_name, test_name) \
|
||||||
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
||||||
: public ::testing::internal::UserTestSuite<test_suite_name> { \
|
: public test_suite_name { \
|
||||||
public: \
|
public: \
|
||||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
|
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
|
||||||
void TestBody() override; \
|
void TestBody() override; \
|
||||||
@ -429,6 +429,11 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
|
|||||||
return 0; \
|
return 0; \
|
||||||
} \
|
} \
|
||||||
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
|
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
|
||||||
|
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, \
|
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
|
||||||
test_name)::gtest_registering_dummy_ = \
|
test_name)::gtest_registering_dummy_ = \
|
||||||
|
@ -190,21 +190,6 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
|
|||||||
const std::string& message);
|
const std::string& message);
|
||||||
std::set<std::string>* GetIgnoredParameterizedTestSuites();
|
std::set<std::string>* GetIgnoredParameterizedTestSuites();
|
||||||
|
|
||||||
// Mix-in class for user tests.
|
|
||||||
// This allows us to add/delete members to/from test suites without having to
|
|
||||||
// modify the test macros themselves.
|
|
||||||
// This makes the code easier to read and maintain, as well making it easier
|
|
||||||
// for users to suppress any warnings originating from these members, as the
|
|
||||||
// members are now declared in an external header instead of in user code.
|
|
||||||
template <class TestClass>
|
|
||||||
class UserTestSuite : public TestClass {
|
|
||||||
public:
|
|
||||||
UserTestSuite() = default;
|
|
||||||
UserTestSuite(const UserTestSuite &) = delete;
|
|
||||||
UserTestSuite &operator=(const UserTestSuite &) = delete;
|
|
||||||
virtual ~UserTestSuite() = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
// The friend relationship of some of these classes is cyclic.
|
// The friend relationship of some of these classes is cyclic.
|
||||||
|
Loading…
Reference in New Issue
Block a user