diff --git a/docs/reference/testing.md b/docs/reference/testing.md index c93556e662..3ed5211117 100644 --- a/docs/reference/testing.md +++ b/docs/reference/testing.md @@ -140,6 +140,7 @@ See also ### TYPED_TEST_SUITE {#TYPED_TEST_SUITE} `TYPED_TEST_SUITE(`*`TestFixtureName`*`,`*`Types`*`)` +`TYPED_TEST_SUITE(`*`TestFixtureName`*`,`*`Types`*`,`*`NameGenerator`*`)` Defines a typed test suite based on the test fixture *`TestFixtureName`*. The test suite name is *`TestFixtureName`*. @@ -169,6 +170,22 @@ TYPED_TEST_SUITE(MyFixture, MyTypes); The type alias (`using` or `typedef`) is necessary for the `TYPED_TEST_SUITE` macro to parse correctly. +The optional third argument *`NameGenerator`* allows specifying a class that +exposes a templated static function `GetName(int)`. For example: + +```cpp +class NameGenerator { + public: + template + static std::string GetName(int) { + if constexpr (std::is_same_v) return "char"; + if constexpr (std::is_same_v) return "int"; + if constexpr (std::is_same_v) return "unsignedInt"; + } +}; +TYPED_TEST_SUITE(MyFixture, MyTypes, NameGenerator); +``` + See also [`TYPED_TEST`](#TYPED_TEST) and [Typed Tests](../advanced.md#typed-tests) for more information.