|
| 1 | +// RUN: %check_clang_tidy -std=c++20 %s readability-identifier-naming %t -- \ |
| 2 | +// RUN: -config='{CheckOptions: { \ |
| 3 | +// RUN: readability-identifier-naming.ClassCase: Camel_Snake_Case, \ |
| 4 | +// RUN: readability-identifier-naming.StructCase: camel_Snake_Back, \ |
| 5 | +// RUN: }}' |
| 6 | + |
| 7 | +// clang-format off |
| 8 | + |
| 9 | +//===----------------------------------------------------------------------===// |
| 10 | +// Camel_Snake_Case tests |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | +class XML_Parser {}; |
| 13 | +class Xml_Parser {}; |
| 14 | +class XML_Parser_2 {}; |
| 15 | +// NO warnings or fixes expected as these identifiers are Camel_Snake_Case |
| 16 | + |
| 17 | +class XmlParser {}; |
| 18 | +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'XmlParser' |
| 19 | +// CHECK-FIXES: {{^}}class Xml_Parser {};{{$}} |
| 20 | + |
| 21 | +class Xml_parser {}; |
| 22 | +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'Xml_parser' |
| 23 | +// CHECK-FIXES: {{^}}class Xml_Parser {};{{$}} |
| 24 | + |
| 25 | +class xml_parser {}; |
| 26 | +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'xml_parser' |
| 27 | +// CHECK-FIXES: {{^}}class Xml_Parser {};{{$}} |
| 28 | + |
| 29 | +class xml_Parser {}; |
| 30 | +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'xml_Parser' |
| 31 | +// CHECK-FIXES: {{^}}class Xml_Parser {};{{$}} |
| 32 | + |
| 33 | +class xml_Parser_2 {}; |
| 34 | +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'xml_Parser_2' |
| 35 | +// CHECK-FIXES: {{^}}class Xml_Parser_2 {};{{$}} |
| 36 | + |
| 37 | +class t {}; |
| 38 | +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 't' |
| 39 | +// CHECK-FIXES: {{^}}class T {};{{$}} |
| 40 | + |
| 41 | +//===----------------------------------------------------------------------===// |
| 42 | +// camel_Snake_Back tests |
| 43 | +//===----------------------------------------------------------------------===// |
| 44 | +struct json_Parser {}; |
| 45 | +struct json_Parser_2 {}; |
| 46 | +struct u {}; |
| 47 | +// NO warnings or fixes expected as these identifiers are camel_Snake_Back |
| 48 | + |
| 49 | +struct JsonParser {}; |
| 50 | +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for struct 'JsonParser' |
| 51 | +// CHECK-FIXES: {{^}}struct json_Parser {};{{$}} |
| 52 | + |
| 53 | +struct Json_parser {}; |
| 54 | +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for struct 'Json_parser' |
| 55 | +// CHECK-FIXES: {{^}}struct json_Parser {};{{$}} |
| 56 | + |
| 57 | +struct json_parser {}; |
| 58 | +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for struct 'json_parser' |
| 59 | +// CHECK-FIXES: {{^}}struct json_Parser {};{{$}} |
| 60 | + |
0 commit comments