| 1 |
.. title:: clang-tidy - google-upgrade-googletest-case |
| 2 |
|
| 3 |
google-upgrade-googletest-case |
| 4 |
============================== |
| 5 |
|
| 6 |
Finds uses of deprecated Google Test version 1.9 APIs with names containing |
| 7 |
``case`` and replaces them with equivalent APIs with ``suite``. |
| 8 |
|
| 9 |
All names containing ``case`` are being replaced to be consistent with the |
| 10 |
meanings of "test case" and "test suite" as used by the International |
| 11 |
Software Testing Qualifications Board and ISO 29119. |
| 12 |
|
| 13 |
The new names are a part of Google Test version 1.9 (release pending). It is |
| 14 |
recommended that users update their dependency to version 1.9 and then use this |
| 15 |
check to remove deprecated names. |
| 16 |
|
| 17 |
The affected APIs are: |
| 18 |
|
| 19 |
- Member functions of ``testing::Test``, ``testing::TestInfo``, |
| 20 |
``testing::TestEventListener``, ``testing::UnitTest``, and any type inheriting |
| 21 |
from these types |
| 22 |
- The macros ``TYPED_TEST_CASE``, ``TYPED_TEST_CASE_P``, |
| 23 |
``REGISTER_TYPED_TEST_CASE_P``, and ``INSTANTIATE_TYPED_TEST_CASE_P`` |
| 24 |
- The type alias ``testing::TestCase`` |
| 25 |
|
| 26 |
Examples of fixes created by this check: |
| 27 |
|
| 28 |
.. code-block:: c++ |
| 29 |
|
| 30 |
class FooTest : public testing::Test { |
| 31 |
public: |
| 32 |
static void SetUpTestCase(); |
| 33 |
static void TearDownTestCase(); |
| 34 |
}; |
| 35 |
|
| 36 |
TYPED_TEST_CASE(BarTest, BarTypes); |
| 37 |
|
| 38 |
becomes |
| 39 |
|
| 40 |
.. code-block:: c++ |
| 41 |
|
| 42 |
class FooTest : public testing::Test { |
| 43 |
public: |
| 44 |
static void SetUpTestSuite(); |
| 45 |
static void TearDownTestSuite(); |
| 46 |
}; |
| 47 |
|
| 48 |
TYPED_TEST_SUITE(BarTest, BarTypes); |
| 49 |
|
| 50 |
For better consistency of user code, the check renames both virtual and |
| 51 |
non-virtual member functions with matching names in derived types. The check |
| 52 |
tries to provide only a warning when a fix cannot be made safely, as is the case |
| 53 |
with some template and macro uses. |