Skip to content

Commit d1a0039

Browse files
Abseil Teamcopybara-github
authored andcommitted
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
1 parent 19387c9 commit d1a0039

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

googletest/include/gtest/gtest-param-test.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
409409

410410
#define TEST_P(test_suite_name, test_name) \
411411
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
412-
: public ::testing::internal::UserTestSuite<test_suite_name> { \
412+
: public test_suite_name { \
413413
public: \
414414
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
415415
void TestBody() override; \
@@ -429,6 +429,11 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
429429
return 0; \
430430
} \
431431
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
432+
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
433+
(const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \
434+
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
435+
const GTEST_TEST_CLASS_NAME_(test_suite_name, \
436+
test_name) &) = delete; /* NOLINT */ \
432437
}; \
433438
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
434439
test_name)::gtest_registering_dummy_ = \

googletest/include/gtest/gtest.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,6 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
190190
const std::string& message);
191191
std::set<std::string>* GetIgnoredParameterizedTestSuites();
192192

193-
// Mix-in class for user tests.
194-
// This allows us to add/delete members to/from test suites without having to
195-
// modify the test macros themselves.
196-
// This makes the code easier to read and maintain, as well making it easier
197-
// for users to suppress any warnings originating from these members, as the
198-
// members are now declared in an external header instead of in user code.
199-
template <class TestClass>
200-
class UserTestSuite : public TestClass {
201-
public:
202-
UserTestSuite() = default;
203-
UserTestSuite(const UserTestSuite &) = delete;
204-
UserTestSuite &operator=(const UserTestSuite &) = delete;
205-
virtual ~UserTestSuite() = default;
206-
};
207-
208193
} // namespace internal
209194

210195
// The friend relationship of some of these classes is cyclic.

0 commit comments

Comments
 (0)