xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/google/upgrade-googletest-case.rst (revision 6e566bc5523f743bc34a7e26f050f1f2b4d699a8)
1.. title:: clang-tidy - google-upgrade-googletest-case
2
3google-upgrade-googletest-case
4==============================
5
6Finds uses of deprecated Google Test version 1.9 APIs with names containing
7``case`` and replaces them with equivalent APIs with ``suite``.
8
9All names containing ``case`` are being replaced to be consistent with the
10meanings of "test case" and "test suite" as used by the International
11Software Testing Qualifications Board and ISO 29119.
12
13The new names are a part of Google Test version 1.9 (release pending). It is
14recommended that users update their dependency to version 1.9 and then use this
15check to remove deprecated names.
16
17The 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
26Examples 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
38becomes
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
50For better consistency of user code, the check renames both virtual and
51non-virtual member functions with matching names in derived types. The check
52tries to provide only a warning when a fix cannot be made safely, as is the case
53with some template and macro uses.
54