diff options
author | Abseil Team <absl-team@google.com> | 2022-09-28 21:58:29 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-09-28 21:59:04 (GMT) |
commit | 19387c9dd5b153a6bdef6f1fc4fb2391fdb122d0 (patch) | |
tree | bd81fa3e5cf72dd06a66870a752d95a8a7639cbb /googletest | |
parent | c43b916a9623e052860f59e52f71de1974ed8823 (diff) | |
download | googletest-19387c9dd5b153a6bdef6f1fc4fb2391fdb122d0.zip googletest-19387c9dd5b153a6bdef6f1fc4fb2391fdb122d0.tar.gz googletest-19387c9dd5b153a6bdef6f1fc4fb2391fdb122d0.tar.bz2 |
Rollback: Uses a simpler mechanism to disable the copying of GoogleTest test suites.
PiperOrigin-RevId: 477560280
Change-Id: I1c1f5a1d6645859ec38cb1a75cd267816d2aff35
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/include/gtest/gtest-param-test.h | 2 | ||||
-rw-r--r-- | googletest/include/gtest/gtest.h | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index 2dbac48..19238ae 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -409,7 +409,7 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) { #define TEST_P(test_suite_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ - : public test_suite_name, private ::testing::internal::NonCopyable { \ + : public ::testing::internal::UserTestSuite<test_suite_name> { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ void TestBody() override; \ diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index 4f037ad..6ff2774 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -190,12 +190,19 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type, const std::string& message); std::set<std::string>* GetIgnoredParameterizedTestSuites(); -class NonCopyable { +// 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: - NonCopyable() = default; - NonCopyable(const NonCopyable &) = delete; - NonCopyable &operator=(const NonCopyable &) = delete; - ~NonCopyable() = default; + UserTestSuite() = default; + UserTestSuite(const UserTestSuite &) = delete; + UserTestSuite &operator=(const UserTestSuite &) = delete; + virtual ~UserTestSuite() = default; }; } // namespace internal |