Commit e9fb5c7b authored by Abseil Team's avatar Abseil Team Committed by Copybara-Service
Browse files

Replace `const char*` with `absl::string_view` as the latter is preferred.

PiperOrigin-RevId: 519122695
Change-Id: I7dcf969d15d26ccc4b376e3ab6db7f4c08c7386f
parent a0ced33a
...@@ -1066,7 +1066,7 @@ they must be declared **public** rather than **protected** in order to use ...@@ -1066,7 +1066,7 @@ they must be declared **public** rather than **protected** in order to use
```c++ ```c++
class FooTest : class FooTest :
public testing::TestWithParam<const char*> { public testing::TestWithParam<absl::string_view> {
// You can implement all the usual fixture class members here. // You can implement all the usual fixture class members here.
// To access the test parameter, call GetParam() from class // To access the test parameter, call GetParam() from class
// TestWithParam<T>. // TestWithParam<T>.
...@@ -1077,7 +1077,7 @@ class BaseTest : public testing::Test { ...@@ -1077,7 +1077,7 @@ class BaseTest : public testing::Test {
... ...
}; };
class BarTest : public BaseTest, class BarTest : public BaseTest,
public testing::WithParamInterface<const char*> { public testing::WithParamInterface<absl::string_view> {
... ...
}; };
``` ```
...@@ -1148,8 +1148,8 @@ with parameter values `"cat"` and `"dog"` using the ...@@ -1148,8 +1148,8 @@ with parameter values `"cat"` and `"dog"` using the
[`ValuesIn`](reference/testing.md#param-generators) parameter generator: [`ValuesIn`](reference/testing.md#param-generators) parameter generator:
```c++ ```c++
const char* pets[] = {"cat", "dog"}; constexpr absl::string_view kPets[] = {"cat", "dog"};
INSTANTIATE_TEST_SUITE_P(Pets, FooTest, testing::ValuesIn(pets)); INSTANTIATE_TEST_SUITE_P(Pets, FooTest, testing::ValuesIn(kPets));
``` ```
The tests from the instantiation above will have these names: The tests from the instantiation above will have these names:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment