Googletest export
Mark legacy _TEST_CASE_ macros as deprecated PiperOrigin-RevId: 232303251
This commit is contained in:
parent
876bdfa565
commit
52ea4f7bea
@ -4858,7 +4858,7 @@ typedef testing::Types<
|
|||||||
list<int> >
|
list<int> >
|
||||||
ContainerEqTestTypes;
|
ContainerEqTestTypes;
|
||||||
|
|
||||||
TYPED_TEST_CASE(ContainerEqTest, ContainerEqTestTypes);
|
TYPED_TEST_SUITE(ContainerEqTest, ContainerEqTestTypes);
|
||||||
|
|
||||||
// Tests that the filled container is equal to itself.
|
// Tests that the filled container is equal to itself.
|
||||||
TYPED_TEST(ContainerEqTest, EqualsSelf) {
|
TYPED_TEST(ContainerEqTest, EqualsSelf) {
|
||||||
@ -6090,7 +6090,7 @@ TEST_P(BipartiteTest, Exhaustive) {
|
|||||||
} while (graph.NextGraph());
|
} while (graph.NextGraph());
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(AllGraphs, BipartiteTest,
|
INSTANTIATE_TEST_SUITE_P(AllGraphs, BipartiteTest,
|
||||||
::testing::Range(0, 5));
|
::testing::Range(0, 5));
|
||||||
|
|
||||||
// Parameterized by a pair interpreted as (LhsSize, RhsSize).
|
// Parameterized by a pair interpreted as (LhsSize, RhsSize).
|
||||||
@ -6133,7 +6133,7 @@ TEST_P(BipartiteNonSquareTest, Exhaustive) {
|
|||||||
} while (graph.NextGraph());
|
} while (graph.NextGraph());
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(AllGraphs, BipartiteNonSquareTest,
|
INSTANTIATE_TEST_SUITE_P(AllGraphs, BipartiteNonSquareTest,
|
||||||
testing::Values(
|
testing::Values(
|
||||||
std::make_pair(1, 2),
|
std::make_pair(1, 2),
|
||||||
std::make_pair(2, 1),
|
std::make_pair(2, 1),
|
||||||
@ -6171,7 +6171,7 @@ TEST_P(BipartiteRandomTest, LargerNets) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test argument is a std::pair<int, int> representing (nodes, iters).
|
// Test argument is a std::pair<int, int> representing (nodes, iters).
|
||||||
INSTANTIATE_TEST_CASE_P(Samples, BipartiteRandomTest,
|
INSTANTIATE_TEST_SUITE_P(Samples, BipartiteRandomTest,
|
||||||
testing::Values(
|
testing::Values(
|
||||||
std::make_pair(5, 10000),
|
std::make_pair(5, 10000),
|
||||||
std::make_pair(6, 5000),
|
std::make_pair(6, 5000),
|
||||||
|
@ -580,7 +580,10 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
|
|||||||
|
|
||||||
// Legacy API is deprecated but still available
|
// Legacy API is deprecated but still available
|
||||||
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
#define INSTANTIATE_TEST_CASE_P INSTANTIATE_TEST_SUITE_P
|
#define INSTANTIATE_TEST_CASE_P \
|
||||||
|
static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \
|
||||||
|
""); \
|
||||||
|
INSTANTIATE_TEST_SUITE_P
|
||||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
@ -226,7 +226,9 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
|||||||
|
|
||||||
// Legacy API is deprecated but still available
|
// Legacy API is deprecated but still available
|
||||||
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
#define TYPED_TEST_CASE TYPED_TEST_SUITE
|
#define TYPED_TEST_CASE \
|
||||||
|
static_assert(::testing::internal::TypedTestCaseIsDeprecated(), ""); \
|
||||||
|
TYPED_TEST_SUITE
|
||||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
|
|
||||||
#endif // GTEST_HAS_TYPED_TEST
|
#endif // GTEST_HAS_TYPED_TEST
|
||||||
@ -265,7 +267,9 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
|||||||
|
|
||||||
// Legacy API is deprecated but still available
|
// Legacy API is deprecated but still available
|
||||||
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
#define TYPED_TEST_CASE_P TYPED_TEST_SUITE_P
|
#define TYPED_TEST_CASE_P \
|
||||||
|
static_assert(::testing::internal::TypedTestCase_P_IsDeprecated(), ""); \
|
||||||
|
TYPED_TEST_SUITE_P
|
||||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
|
|
||||||
#define TYPED_TEST_P(SuiteName, TestName) \
|
#define TYPED_TEST_P(SuiteName, TestName) \
|
||||||
@ -296,7 +300,10 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
|||||||
|
|
||||||
// Legacy API is deprecated but still available
|
// Legacy API is deprecated but still available
|
||||||
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
#define REGISTER_TYPED_TEST_CASE_P REGISTER_TYPED_TEST_SUITE_P
|
#define REGISTER_TYPED_TEST_CASE_P \
|
||||||
|
static_assert(::testing::internal::RegisterTypedTestCase_P_IsDeprecated(), \
|
||||||
|
""); \
|
||||||
|
REGISTER_TYPED_TEST_SUITE_P
|
||||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
|
|
||||||
// The 'Types' template argument below must have spaces around it
|
// The 'Types' template argument below must have spaces around it
|
||||||
@ -318,7 +325,10 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
|||||||
|
|
||||||
// Legacy API is deprecated but still available
|
// Legacy API is deprecated but still available
|
||||||
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
#define INSTANTIATE_TYPED_TEST_CASE_P INSTANTIATE_TYPED_TEST_SUITE_P
|
#define INSTANTIATE_TYPED_TEST_CASE_P \
|
||||||
|
static_assert( \
|
||||||
|
::testing::internal::InstantiateTypedTestCase_P_IsDeprecated(), ""); \
|
||||||
|
INSTANTIATE_TYPED_TEST_SUITE_P
|
||||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
|
|
||||||
#endif // GTEST_HAS_TYPED_TEST_P
|
#endif // GTEST_HAS_TYPED_TEST_P
|
||||||
|
@ -1282,6 +1282,33 @@ class FlatTuple
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Utility functions to be called with static_assert to induce deprecation
|
||||||
|
// warinings
|
||||||
|
GTEST_INTERNAL_DEPRECATED(
|
||||||
|
"INSTANTIATE_TEST_CASE_P is deprecated, please use "
|
||||||
|
"INSTANTIATE_TEST_SUITE_P")
|
||||||
|
constexpr bool InstantiateTestCase_P_IsDeprecated() { return true; }
|
||||||
|
|
||||||
|
GTEST_INTERNAL_DEPRECATED(
|
||||||
|
"TYPED_TEST_CASE_P is deprecated, please use "
|
||||||
|
"TYPED_TEST_SUITE_P")
|
||||||
|
constexpr bool TypedTestCase_P_IsDeprecated() { return true; }
|
||||||
|
|
||||||
|
GTEST_INTERNAL_DEPRECATED(
|
||||||
|
"TYPED_TEST_CASE is deprecated, please use "
|
||||||
|
"TYPED_TEST_SUITE")
|
||||||
|
constexpr bool TypedTestCaseIsDeprecated() { return true; }
|
||||||
|
|
||||||
|
GTEST_INTERNAL_DEPRECATED(
|
||||||
|
"REGISTER_TYPED_TEST_CASE_P is deprecated, please use "
|
||||||
|
"REGISTER_TYPED_TEST_SUITE_P")
|
||||||
|
constexpr bool RegisterTypedTestCase_P_IsDeprecated() { return true; }
|
||||||
|
|
||||||
|
GTEST_INTERNAL_DEPRECATED(
|
||||||
|
"INSTANTIATE_TYPED_TEST_CASE_P is deprecated, please use "
|
||||||
|
"INSTANTIATE_TYPED_TEST_SUITE_P")
|
||||||
|
constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
@ -1426,19 +1453,4 @@ class FlatTuple
|
|||||||
test_suite_name, test_name)>); \
|
test_suite_name, test_name)>); \
|
||||||
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
|
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
|
||||||
|
|
||||||
// Internal Macro to mark an API deprecated, for googletest usage only
|
|
||||||
// Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or
|
|
||||||
// GTEST_INTERNAL_DEPRECATED(message) <return_type> myFunction(); Every usage of
|
|
||||||
// a deprecated entity will trigger a warning when compiled with
|
|
||||||
// `-Wdeprecated-declarations` option (clang, gcc, any __GNUC__ compiler).
|
|
||||||
// For msvc /W3 option will need to be used
|
|
||||||
// Note that for 'other' compilers this macro evaluates to nothing to prevent
|
|
||||||
// compilations errors.
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define GTEST_INTERNAL_DEPRECATED(message) __declspec(deprecated(message))
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
#define GTEST_INTERNAL_DEPRECATED(message) __attribute__((deprecated(message)))
|
|
||||||
#else
|
|
||||||
#define GTEST_INTERNAL_DEPRECATED(message)
|
|
||||||
#endif
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
|
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
|
||||||
|
@ -2296,4 +2296,20 @@ const char* StringFromGTestEnv(const char* flag, const char* default_val);
|
|||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
// Internal Macro to mark an API deprecated, for googletest usage only
|
||||||
|
// Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or
|
||||||
|
// GTEST_INTERNAL_DEPRECATED(message) <return_type> myFunction(); Every usage of
|
||||||
|
// a deprecated entity will trigger a warning when compiled with
|
||||||
|
// `-Wdeprecated-declarations` option (clang, gcc, any __GNUC__ compiler).
|
||||||
|
// For msvc /W3 option will need to be used
|
||||||
|
// Note that for 'other' compilers this macro evaluates to nothing to prevent
|
||||||
|
// compilations errors.
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define GTEST_INTERNAL_DEPRECATED(message) __declspec(deprecated(message))
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define GTEST_INTERNAL_DEPRECATED(message) __attribute__((deprecated(message)))
|
||||||
|
#else
|
||||||
|
#define GTEST_INTERNAL_DEPRECATED(message)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
|
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
|
||||||
|
@ -84,7 +84,7 @@ using testing::Types;
|
|||||||
|
|
||||||
// To write a typed test case, first use
|
// To write a typed test case, first use
|
||||||
//
|
//
|
||||||
// TYPED_TEST_CASE(TestCaseName, TypeList);
|
// TYPED_TEST_SUITE(TestCaseName, TypeList);
|
||||||
//
|
//
|
||||||
// to declare it and specify the type parameters. As with TEST_F,
|
// to declare it and specify the type parameters. As with TEST_F,
|
||||||
// TestCaseName must match the test fixture name.
|
// TestCaseName must match the test fixture name.
|
||||||
@ -131,7 +131,7 @@ TYPED_TEST(PrimeTableTest, CanGetNextPrime) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// That's it! Google Test will repeat each TYPED_TEST for each type
|
// That's it! Google Test will repeat each TYPED_TEST for each type
|
||||||
// in the type list specified in TYPED_TEST_CASE. Sit back and be
|
// in the type list specified in TYPED_TEST_SUITE. Sit back and be
|
||||||
// happy that you don't have to define them multiple times.
|
// happy that you don't have to define them multiple times.
|
||||||
|
|
||||||
#endif // GTEST_HAS_TYPED_TEST
|
#endif // GTEST_HAS_TYPED_TEST
|
||||||
|
Loading…
Reference in New Issue
Block a user