summaryrefslogtreecommitdiffstats
path: root/test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp
blob: 6e8a5c2d50af9c6eb16b4018c81e5e8f2caadab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// RUN: %check_clang_tidy %s google-readability-avoid-underscore-in-googletest-name %t

#define TEST(test_case_name, test_name) void test_case_name##test_name()
#define TEST_F(test_case_name, test_name) void test_case_name##test_name()
#define TEST_P(test_case_name, test_name) void test_case_name##test_name()
#define TYPED_TEST(test_case_name, test_name) void test_case_name##test_name()
#define TYPED_TEST_P(test_case_name, test_name) void test_case_name##test_name()
#define FRIEND_TEST(test_case_name, test_name) void test_case_name##test_name()

TEST(TestCaseName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TEST(TestCaseName, DISABLED_Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST(TestCaseName, Illegal_Test_Name) {}
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST(Illegal_TestCaseName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST(Illegal_Test_CaseName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_Test_CaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST(Illegal_TestCaseName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
// CHECK-MESSAGES: :[[@LINE-2]]:28: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TEST_F(TestCaseFixtureName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST_F(TestCaseFixtureName, DISABLED_Illegal_Test_Name) {}
// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST_F(TestCaseFixtureName, Illegal_Test_Name) {}
// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TEST_F(Illegal_TestCaseFixtureName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST_F(Illegal_TestCaseFixtureName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TEST_F(Illegal_Test_CaseFixtureName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_Test_CaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TEST_P(ParameterizedTestCaseFixtureName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST_P(ParameterizedTestCaseFixtureName, DISABLED_Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST_P(ParameterizedTestCaseFixtureName, Illegal_Test_Name) {}
// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TEST_P(Illegal_ParameterizedTestCaseFixtureName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_ParameterizedTestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TEST_P(Illegal_ParameterizedTestCaseFixtureName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_ParameterizedTestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
// CHECK-MESSAGES: :[[@LINE-2]]:50: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TEST_P(Illegal_Parameterized_TestCaseFixtureName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_Parameterized_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TYPED_TEST(TypedTestCaseName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TYPED_TEST(TypedTestCaseName, DISABLED_Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TYPED_TEST(TypedTestCaseName, Illegal_Test_Name) {}
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TYPED_TEST(Illegal_TypedTestCaseName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_TypedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TYPED_TEST(Illegal_TypedTestCaseName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_TypedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
// CHECK-MESSAGES: :[[@LINE-2]]:39: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TYPED_TEST(Illegal_Typed_TestCaseName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_Typed_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TYPED_TEST_P(TypeParameterizedTestCaseName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TYPED_TEST_P(TypeParameterizedTestCaseName, DISABLED_Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TYPED_TEST_P(TypeParameterizedTestCaseName, Illegal_Test_Name) {}
// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TYPED_TEST_P(Illegal_TypeParameterizedTestCaseName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_TypeParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
TYPED_TEST_P(Illegal_TypeParameterizedTestCaseName, Illegal_TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_TypeParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
// CHECK-MESSAGES: :[[@LINE-2]]:53: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

TYPED_TEST_P(Illegal_Type_ParameterizedTestCaseName, TestName) {}
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_Type_ParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]

// Underscores are allowed to disable a test with the DISABLED_ prefix.
// https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
TEST(TestCaseName, TestName) {}
TEST(TestCaseName, DISABLED_TestName) {}

TEST_F(TestCaseFixtureName, TestName) {}
TEST_F(TestCaseFixtureName, DISABLED_TestName) {}

TEST_P(ParameterizedTestCaseFixtureName, TestName) {}
TEST_P(ParameterizedTestCaseFixtureName, DISABLED_TestName) {}

TYPED_TEST(TypedTestName, TestName) {}
TYPED_TEST(TypedTestName, DISABLED_TestName) {}

TYPED_TEST_P(TypeParameterizedTestName, TestName) {}
TYPED_TEST_P(TypeParameterizedTestName, DISABLED_TestName) {}

FRIEND_TEST(FriendTest, Is_NotChecked) {}
FRIEND_TEST(Friend_Test, IsNotChecked) {}
FRIEND_TEST(Friend_Test, Is_NotChecked) {}