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//===----------------------------------------------------------------------===//
12class XML_Parser {};
13class Xml_Parser {};
14class XML_Parser_2 {};
15// NO warnings or fixes expected as these identifiers are Camel_Snake_Case
16
17class XmlParser {};
18// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'XmlParser'
19// CHECK-FIXES: {{^}}class Xml_Parser {};{{$}}
20
21class Xml_parser {};
22// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'Xml_parser'
23// CHECK-FIXES: {{^}}class Xml_Parser {};{{$}}
24
25class xml_parser {};
26// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'xml_parser'
27// CHECK-FIXES: {{^}}class Xml_Parser {};{{$}}
28
29class xml_Parser {};
30// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'xml_Parser'
31// CHECK-FIXES: {{^}}class Xml_Parser {};{{$}}
32
33class 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
37class 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//===----------------------------------------------------------------------===//
44struct json_Parser {};
45struct json_Parser_2 {};
46struct u {};
47// NO warnings or fixes expected as these identifiers are camel_Snake_Back
48
49struct JsonParser {};
50// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for struct 'JsonParser'
51// CHECK-FIXES: {{^}}struct json_Parser {};{{$}}
52
53struct Json_parser {};
54// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for struct 'Json_parser'
55// CHECK-FIXES: {{^}}struct json_Parser {};{{$}}
56
57struct json_parser {};
58// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for struct 'json_parser'
59// CHECK-FIXES: {{^}}struct json_Parser {};{{$}}
60
61

source code of clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-case-match.cpp