Skip to content

Commit 244cec8

Browse files
Abseil Teamcopybara-github
authored andcommitted
Update the document in typed tests to use using-declaration instead of typedef
PiperOrigin-RevId: 793600153 Change-Id: I0c78f180f3b681ef20133af2cc822af66c3344fe
1 parent 373af2e commit 244cec8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ template <typename T>
4848
class FooTest : public testing::Test {
4949
public:
5050
...
51-
typedef std::list<T> List;
51+
using List = ::std::list<T>;
5252
static T shared_;
5353
T value_;
5454
};
5555

5656
// Next, associate a list of types with the test suite, which will be
57-
// repeated for each type in the list. The typedef is necessary for
57+
// repeated for each type in the list. The using-declaration is necessary for
5858
// the macro to parse correctly.
59-
typedef testing::Types<char, int, unsigned int> MyTypes;
59+
using MyTypes = ::testing::Types<char, int, unsigned int>;
6060
TYPED_TEST_SUITE(FooTest, MyTypes);
6161

6262
// If the type list contains only one type, you can write that type
@@ -157,7 +157,7 @@ REGISTER_TYPED_TEST_SUITE_P(FooTest,
157157
// argument to the INSTANTIATE_* macro is a prefix that will be added
158158
// to the actual test suite name. Remember to pick unique prefixes for
159159
// different instances.
160-
typedef testing::Types<char, int, unsigned int> MyTypes;
160+
using MyTypes = ::testing::Types<char, int, unsigned int>;
161161
INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
162162

163163
// If the type list contains only one type, you can write that type

0 commit comments

Comments
 (0)