mirror of
https://github.com/google/googletest.git
synced 2025-03-10 09:16:48 +00:00
Uses a simpler mechanism to disable the copying of GoogleTest test suites, to move code out of the TEST_P macro.
PiperOrigin-RevId: 478031678 Change-Id: I45f0ce17a4add526c86b8212d836d98d63b3a193
This commit is contained in:
parent
d1a0039b97
commit
93f08be653
@ -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 test_suite_name { \
|
: public test_suite_name, private ::testing::internal::GTestNonCopyable {\
|
||||||
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,11 +429,6 @@ 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,6 +190,17 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
|
|||||||
const std::string& message);
|
const std::string& message);
|
||||||
std::set<std::string>* GetIgnoredParameterizedTestSuites();
|
std::set<std::string>* GetIgnoredParameterizedTestSuites();
|
||||||
|
|
||||||
|
// A base class that prevents subclasses from being copyable.
|
||||||
|
// We do this instead of using '= delete' so as to avoid triggering warnings
|
||||||
|
// inside user code regarding any of our declarations.
|
||||||
|
class GTestNonCopyable {
|
||||||
|
public:
|
||||||
|
GTestNonCopyable() = default;
|
||||||
|
GTestNonCopyable(const GTestNonCopyable &) = delete;
|
||||||
|
GTestNonCopyable &operator=(const GTestNonCopyable &) = delete;
|
||||||
|
~GTestNonCopyable() = 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…
x
Reference in New Issue
Block a user