1 | // Setup header directory |
2 | |
3 | // RUN: rm -rf %theaders |
4 | // RUN: mkdir %theaders |
5 | // RUN: cp -R %S/Inputs/identifier-naming/. %theaders |
6 | |
7 | // C++11 isn't explicitly required, but failing to specify a standard means the |
8 | // check will run multiple times for different standards. This will cause the |
9 | // second test to fail as the header file will be changed during the first run. |
10 | // InheritParentConfig is needed to look for the clang-tidy configuration files. |
11 | |
12 | // RUN: %check_clang_tidy -check-suffixes=ENABLED,SHARED -std=c++11 %s \ |
13 | // RUN: readability-identifier-naming %t -- \ |
14 | // RUN: -config='{ InheritParentConfig: true, CheckOptions: { \ |
15 | // RUN: readability-identifier-naming.FunctionCase: camelBack, \ |
16 | // RUN: readability-identifier-naming.ParameterCase: CamelCase, \ |
17 | // RUN: readability-identifier-naming.GetConfigPerFile: true \ |
18 | // RUN: }}' -header-filter='.*' -- -I%theaders |
19 | |
20 | // On DISABLED run, everything should be made 'camelBack'. |
21 | |
22 | // RUN: cp -R %S/Inputs/identifier-naming/. %theaders |
23 | // RUN: %check_clang_tidy -check-suffixes=DISABLED,SHARED -std=c++11 %s \ |
24 | // RUN: readability-identifier-naming %t -- \ |
25 | // RUN: -config='{ InheritParentConfig: false, CheckOptions: { \ |
26 | // RUN: readability-identifier-naming.FunctionCase: camelBack, \ |
27 | // RUN: readability-identifier-naming.ParameterCase: CamelCase, \ |
28 | // RUN: readability-identifier-naming.GetConfigPerFile: false \ |
29 | // RUN: }}' -header-filter='.*' -- -I%theaders |
30 | |
31 | #include "global-style1/header.h" |
32 | #include "global-style2/header.h" |
33 | |
34 | void goodStyle() { |
35 | style_first_good(); |
36 | STYLE_SECOND_GOOD(); |
37 | // CHECK-FIXES-DISABLED: styleFirstGood(); |
38 | // CHECK-FIXES-DISABLED-NEXT: styleSecondGood(); |
39 | } |
40 | // CHECK-MESSAGES-SHARED: :[[@LINE+1]]:6: warning: invalid case style for function 'bad_style' |
41 | void bad_style() { |
42 | styleFirstBad(); |
43 | styleSecondBad(); |
44 | } |
45 | // CHECK-FIXES-SHARED: void badStyle() { |
46 | // CHECK-FIXES-DISABLED-NEXT: styleFirstBad(); |
47 | // CHECK-FIXES-ENABLED-NEXT: style_first_bad(); |
48 | // CHECK-FIXES-DISABLED-NEXT: styleSecondBad(); |
49 | // CHECK-FIXES-ENABLED-NEXT: STYLE_SECOND_BAD(); |
50 | // CHECK-FIXES-SHARED-NEXT: } |
51 | |
52 | // CHECK-MESSAGES-DISABLED: global-style1/header.h:3:6: warning: invalid case style for function 'style_first_good' |
53 | // CHECK-MESSAGES-ENABLED: global-style1/header.h:5:6: warning: invalid case style for global function 'styleFirstBad' |
54 | // CHECK-MESSAGES-ENABLED: global-style1/header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeIgnored' |
55 | // CHECK-MESSAGES-DISABLED: global-style1/header.h:7:31: warning: invalid case style for parameter 'argc' |
56 | // CHECK-MESSAGES-DISABLED: global-style1/header.h:7:49: warning: invalid case style for parameter 'argv' |
57 | |
58 | // CHECK-MESSAGES-DISABLED: global-style2/header.h:3:6: warning: invalid case style for function 'STYLE_SECOND_GOOD' |
59 | // CHECK-MESSAGES-ENABLED: global-style2/header.h:5:6: warning: invalid case style for global function 'styleSecondBad' |
60 | // CHECK-MESSAGES-ENABLED: global-style2/header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeNotIgnored' |
61 | // CHECK-MESSAGES-SHARED: global-style2/header.h:7:34: warning: invalid case style for parameter 'argc' |
62 | // CHECK-MESSAGES-SHARED: global-style2/header.h:7:52: warning: invalid case style for parameter 'argv' |
63 | |