1 | // RUN: clang-tidy -dump-config %S/Inputs/config-files/- -- | FileCheck %s -check-prefix=CHECK-BASE |
2 | // CHECK-BASE: Checks: {{.*}}from-parent |
3 | // CHECK-BASE: HeaderFilterRegex: parent |
4 | // RUN: clang-tidy -dump-config %S/Inputs/config-files/1/- -- | FileCheck %s -check-prefix=CHECK-CHILD1 |
5 | // CHECK-CHILD1: Checks: {{.*}}from-child1 |
6 | // CHECK-CHILD1: HeaderFilterRegex: child1 |
7 | // RUN: clang-tidy -dump-config %S/Inputs/config-files/2/- -- | FileCheck %s -check-prefix=CHECK-CHILD2 |
8 | // CHECK-CHILD2: Checks: {{.*}}from-parent |
9 | // CHECK-CHILD2: HeaderFilterRegex: parent |
10 | // RUN: clang-tidy -dump-config %S/Inputs/config-files/3/- -- | FileCheck %s -check-prefix=CHECK-CHILD3 |
11 | // CHECK-CHILD3: Checks: {{.*}}from-parent,from-child3 |
12 | // CHECK-CHILD3: HeaderFilterRegex: child3 |
13 | // RUN: clang-tidy -dump-config -checks='from-command-line' -header-filter='from command line' %S/Inputs/config-files/- -- | FileCheck %s -check-prefix=CHECK-COMMAND-LINE |
14 | // CHECK-COMMAND-LINE: Checks: {{.*}}from-parent,from-command-line |
15 | // CHECK-COMMAND-LINE: HeaderFilterRegex: from command line |
16 | |
17 | // For this test we have to use names of the real checks because otherwise values are ignored. |
18 | // Running with the old key: <Key>, value: <value> CheckOptions |
19 | // RUN: clang-tidy -dump-config %S/Inputs/config-files/4/44/- -- | FileCheck %s -check-prefix=CHECK-CHILD4 |
20 | // Running with the new <key>: <value> syntax |
21 | // RUN: clang-tidy -dump-config %S/Inputs/config-files/4/key-dict/- -- | FileCheck %s -check-prefix=CHECK-CHILD4 |
22 | |
23 | // CHECK-CHILD4: Checks: {{.*}}modernize-loop-convert,modernize-use-using,llvm-qualified-auto |
24 | // CHECK-CHILD4-DAG: llvm-qualified-auto.AddConstToQualified: 'true' |
25 | // CHECK-CHILD4-DAG: modernize-loop-convert.MaxCopySize: '20' |
26 | // CHECK-CHILD4-DAG: modernize-loop-convert.MinConfidence: reasonable |
27 | // CHECK-CHILD4-DAG: modernize-use-using.IgnoreMacros: 'false' |
28 | |
29 | // RUN: clang-tidy --explain-config %S/Inputs/config-files/4/44/- -- | FileCheck %s -check-prefix=CHECK-EXPLAIN |
30 | // CHECK-EXPLAIN: 'llvm-qualified-auto' is enabled in the {{.*}}{{[/\\]}}Inputs{{[/\\]}}config-files{{[/\\]}}4{{[/\\]}}44{{[/\\]}}.clang-tidy. |
31 | // CHECK-EXPLAIN: 'modernize-loop-convert' is enabled in the {{.*}}{{[/\\]}}Inputs{{[/\\]}}config-files{{[/\\]}}4{{[/\\]}}.clang-tidy. |
32 | // CHECK-EXPLAIN: 'modernize-use-using' is enabled in the {{.*}}{{[/\\]}}Inputs{{[/\\]}}config-files{{[/\\]}}4{{[/\\]}}.clang-tidy. |
33 | |
34 | // RUN: clang-tidy -dump-config \ |
35 | // RUN: --config='{InheritParentConfig: true, \ |
36 | // RUN: Checks: -llvm-qualified-auto, \ |
37 | // RUN: CheckOptions: [{key: modernize-loop-convert.MaxCopySize, value: 21}]}' \ |
38 | // RUN: %S/Inputs/config-files/4/44/- -- | FileCheck %s -check-prefix=CHECK-CHILD5 |
39 | // Also test with the {Key: Value} Syntax specified on command line |
40 | // RUN: clang-tidy -dump-config \ |
41 | // RUN: --config='{InheritParentConfig: true, \ |
42 | // RUN: Checks: -llvm-qualified-auto, \ |
43 | // RUN: CheckOptions: {modernize-loop-convert.MaxCopySize: 21}}' \ |
44 | // RUN: %S/Inputs/config-files/4/44/- -- | FileCheck %s -check-prefix=CHECK-CHILD5 |
45 | |
46 | // CHECK-CHILD5: Checks: {{.*}}modernize-loop-convert,modernize-use-using,llvm-qualified-auto,-llvm-qualified-auto |
47 | // CHECK-CHILD5-DAG: modernize-loop-convert.MaxCopySize: '21' |
48 | // CHECK-CHILD5-DAG: modernize-loop-convert.MinConfidence: reasonable |
49 | // CHECK-CHILD5-DAG: modernize-use-using.IgnoreMacros: 'false' |
50 | |
51 | // RUN: clang-tidy -dump-config \ |
52 | // RUN: --config='{InheritParentConfig: false, \ |
53 | // RUN: Checks: -llvm-qualified-auto}' \ |
54 | // RUN: %S/Inputs/config-files/4/44/- -- | FileCheck %s -check-prefix=CHECK-CHILD6 |
55 | // CHECK-CHILD6: Checks: {{.*-llvm-qualified-auto'? *$}} |
56 | // CHECK-CHILD6-NOT: modernize-use-using.IgnoreMacros |
57 | |
58 | // RUN: clang-tidy -dump-config \ |
59 | // RUN: --config='{CheckOptions: {readability-function-size.LineThreshold: ""}, \ |
60 | // RUN: Checks: readability-function-size}' \ |
61 | // RUN: %S/Inputs/config-files/4/44/- -- | FileCheck %s -check-prefix=CHECK-CHILD7 |
62 | // CHECK-CHILD7: readability-function-size.LineThreshold: none |
63 | |
64 | |
65 | // Validate that check options are printed in alphabetical order: |
66 | // RUN: clang-tidy --checks="-*,readability-identifier-naming" --dump-config %S/Inputs/config-files/- -- | grep "readability-identifier-naming\." | sort --check |
67 | |
68 | // Dumped config does not overflow for unsigned options |
69 | // RUN: clang-tidy --dump-config \ |
70 | // RUN: --checks="-*,misc-throw-by-value-catch-by-reference" \ |
71 | // RUN: -- | grep -v -q "misc-throw-by-value-catch-by-reference.MaxSize: '-1'" |
72 | |
73 | // RUN: clang-tidy --dump-config %S/Inputs/config-files/5/- \ |
74 | // RUN: -- | grep -q "misc-throw-by-value-catch-by-reference.MaxSize: '1152921504606846976'" |
75 | |