Skip to content

Commit 6cd3823

Browse files
elixircopybara-github
authored andcommitted
Clarify that this-> is needed to access members of type-parameterized tests.
PiperOrigin-RevId: 451439108 Change-Id: I8929df21d53cbe6c42e38653e1bb0cac72fc36f9
1 parent 2835677 commit 6cd3823

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/advanced.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,7 @@ First, define a fixture class template, as we did with typed tests:
13131313
```c++
13141314
template <typename T>
13151315
class FooTest : public testing::Test {
1316+
void DoSomethingInteresting();
13161317
...
13171318
};
13181319
```
@@ -1330,6 +1331,9 @@ this as many times as you want:
13301331
TYPED_TEST_P(FooTest, DoesBlah) {
13311332
// Inside a test, refer to TypeParam to get the type parameter.
13321333
TypeParam n = 0;
1334+
1335+
// You will need to use `this` explicitly to refer to fixture members.
1336+
this->DoSomethingInteresting()
13331337
...
13341338
}
13351339

0 commit comments

Comments
 (0)