1 // RUN: %check_clang_tidy %s google-readability-avoid-underscore-in-googletest-name %t 2 3 #define TEST(test_case_name, test_name) void test_case_name##test_name() 4 #define TEST_F(test_case_name, test_name) void test_case_name##test_name() 5 #define TEST_P(test_case_name, test_name) void test_case_name##test_name() 6 #define TYPED_TEST(test_case_name, test_name) void test_case_name##test_name() 7 #define TYPED_TEST_P(test_case_name, test_name) void test_case_name##test_name() 8 #define FRIEND_TEST(test_case_name, test_name) void test_case_name##test_name() 9 10 TEST(TestCaseName, Illegal_TestName) {} 11 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 12 13 TEST(TestCaseName, DISABLED_Illegal_TestName) {} 14 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 15 TEST(TestCaseName, Illegal_Test_Name) {} 16 // 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] 17 TEST(Illegal_TestCaseName, TestName) {} 18 // 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] 19 TEST(Illegal_Test_CaseName, TestName) {} 20 // 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] 21 TEST(Illegal_TestCaseName, Illegal_TestName) {} 22 // 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] 23 // CHECK-MESSAGES: :[[@LINE-2]]:28: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 24 25 TEST_F(TestCaseFixtureName, Illegal_TestName) {} 26 // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 27 TEST_F(TestCaseFixtureName, DISABLED_Illegal_Test_Name) {} 28 // 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] 29 TEST_F(TestCaseFixtureName, Illegal_Test_Name) {} 30 // 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] 31 32 TEST_F(Illegal_TestCaseFixtureName, TestName) {} 33 // 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] 34 TEST_F(Illegal_TestCaseFixtureName, Illegal_TestName) {} 35 // 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] 36 // CHECK-MESSAGES: :[[@LINE-2]]:37: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 37 38 TEST_F(Illegal_Test_CaseFixtureName, TestName) {} 39 // 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] 40 41 TEST_P(ParameterizedTestCaseFixtureName, Illegal_TestName) {} 42 // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 43 TEST_P(ParameterizedTestCaseFixtureName, DISABLED_Illegal_TestName) {} 44 // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 45 TEST_P(ParameterizedTestCaseFixtureName, Illegal_Test_Name) {} 46 // 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] 47 48 TEST_P(Illegal_ParameterizedTestCaseFixtureName, TestName) {} 49 // 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] 50 TEST_P(Illegal_ParameterizedTestCaseFixtureName, Illegal_TestName) {} 51 // 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] 52 // CHECK-MESSAGES: :[[@LINE-2]]:50: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 53 54 TEST_P(Illegal_Parameterized_TestCaseFixtureName, TestName) {} 55 // 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] 56 57 TYPED_TEST(TypedTestCaseName, Illegal_TestName) {} 58 // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 59 TYPED_TEST(TypedTestCaseName, DISABLED_Illegal_TestName) {} 60 // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 61 TYPED_TEST(TypedTestCaseName, Illegal_Test_Name) {} 62 // 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] 63 64 TYPED_TEST(Illegal_TypedTestCaseName, TestName) {} 65 // 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] 66 TYPED_TEST(Illegal_TypedTestCaseName, Illegal_TestName) {} 67 // 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] 68 // CHECK-MESSAGES: :[[@LINE-2]]:39: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 69 70 TYPED_TEST(Illegal_Typed_TestCaseName, TestName) {} 71 // 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] 72 73 TYPED_TEST_P(TypeParameterizedTestCaseName, Illegal_TestName) {} 74 // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 75 TYPED_TEST_P(TypeParameterizedTestCaseName, DISABLED_Illegal_TestName) {} 76 // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 77 TYPED_TEST_P(TypeParameterizedTestCaseName, Illegal_Test_Name) {} 78 // 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] 79 80 TYPED_TEST_P(Illegal_TypeParameterizedTestCaseName, TestName) {} 81 // 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] 82 TYPED_TEST_P(Illegal_TypeParameterizedTestCaseName, Illegal_TestName) {} 83 // 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] 84 // CHECK-MESSAGES: :[[@LINE-2]]:53: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name] 85 86 TYPED_TEST_P(Illegal_Type_ParameterizedTestCaseName, TestName) {} 87 // 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] 88 89 // Underscores are allowed to disable a test with the DISABLED_ prefix. 90 // https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore 91 TEST(TestCaseName, TestName) {} 92 TEST(TestCaseName, DISABLED_TestName) {} 93 94 TEST_F(TestCaseFixtureName, TestName) {} 95 TEST_F(TestCaseFixtureName, DISABLED_TestName) {} 96 97 TEST_P(ParameterizedTestCaseFixtureName, TestName) {} 98 TEST_P(ParameterizedTestCaseFixtureName, DISABLED_TestName) {} 99 100 TYPED_TEST(TypedTestName, TestName) {} 101 TYPED_TEST(TypedTestName, DISABLED_TestName) {} 102 103 TYPED_TEST_P(TypeParameterizedTestName, TestName) {} 104 TYPED_TEST_P(TypeParameterizedTestName, DISABLED_TestName) {} 105 106 FRIEND_TEST(FriendTest, Is_NotChecked) {} 107 FRIEND_TEST(Friend_Test, IsNotChecked) {} 108 FRIEND_TEST(Friend_Test, Is_NotChecked) {} 109