mirror of
https://github.com/google/googletest.git
synced 2025-12-06 16:57:00 +08:00
Update the document in typed tests to use using-declaration instead of typedef
PiperOrigin-RevId: 793600153 Change-Id: I0c78f180f3b681ef20133af2cc822af66c3344fe
This commit is contained in:
parent
373af2e3df
commit
244cec869d
@ -48,15 +48,15 @@ template <typename T>
|
|||||||
class FooTest : public testing::Test {
|
class FooTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
...
|
...
|
||||||
typedef std::list<T> List;
|
using List = ::std::list<T>;
|
||||||
static T shared_;
|
static T shared_;
|
||||||
T value_;
|
T value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Next, associate a list of types with the test suite, which will be
|
// Next, associate a list of types with the test suite, which will be
|
||||||
// repeated for each type in the list. The typedef is necessary for
|
// repeated for each type in the list. The using-declaration is necessary for
|
||||||
// the macro to parse correctly.
|
// the macro to parse correctly.
|
||||||
typedef testing::Types<char, int, unsigned int> MyTypes;
|
using MyTypes = ::testing::Types<char, int, unsigned int>;
|
||||||
TYPED_TEST_SUITE(FooTest, MyTypes);
|
TYPED_TEST_SUITE(FooTest, MyTypes);
|
||||||
|
|
||||||
// If the type list contains only one type, you can write that type
|
// If the type list contains only one type, you can write that type
|
||||||
@ -157,7 +157,7 @@ REGISTER_TYPED_TEST_SUITE_P(FooTest,
|
|||||||
// argument to the INSTANTIATE_* macro is a prefix that will be added
|
// argument to the INSTANTIATE_* macro is a prefix that will be added
|
||||||
// to the actual test suite name. Remember to pick unique prefixes for
|
// to the actual test suite name. Remember to pick unique prefixes for
|
||||||
// different instances.
|
// different instances.
|
||||||
typedef testing::Types<char, int, unsigned int> MyTypes;
|
using MyTypes = ::testing::Types<char, int, unsigned int>;
|
||||||
INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
||||||
|
|
||||||
// If the type list contains only one type, you can write that type
|
// If the type list contains only one type, you can write that type
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user