xref: /llvm-project/clang-tools-extra/test/clang-tidy/infrastructure/verify-config.cpp (revision f94ed6f7977305db8fa6b48a85c9db2b8cc4d3b3)
15ca68d58SNathan James // RUN: clang-tidy -verify-config --config='' | FileCheck %s -check-prefix=CHECK-VERIFY-OK
25ca68d58SNathan James // CHECK-VERIFY-OK: No config errors detected.
35ca68d58SNathan James 
45ca68d58SNathan James // RUN: not clang-tidy -verify-config \
55ca68d58SNathan James // RUN: --checks='-*,bad*glob,llvm*,llvm-includeorder,my-made-up-check' --config='{Checks: "readability-else-after-ret", \
65b37cddfSCarlos Galvez // RUN: HeaderFileExtensions: ["h", "hh", "hpp"], \
75b37cddfSCarlos Galvez // RUN: ImplementationFileExtensions: ["c", "cc", "hpp"], \
8e8a3ddafSNathan James // RUN: CheckOptions: {IgnoreMacros: true, \
9e8a3ddafSNathan James // RUN:                StriceMode: true, \
10e8a3ddafSNathan James // RUN:                modernize-lop-convert.UseCxx20ReverseRanges: true \
11e8a3ddafSNathan James // RUN:               }}' 2>&1 | FileCheck %s \
125ca68d58SNathan James // RUN: -check-prefix=CHECK-VERIFY -implicit-check-not='{{warning|error}}:'
135ca68d58SNathan James 
145ca68d58SNathan James // CHECK-VERIFY-DAG: command-line option '-config': warning: unknown check 'readability-else-after-ret'; did you mean 'readability-else-after-return' [-verify-config]
155ca68d58SNathan James // CHECK-VERIFY-DAG: command-line option '-config': warning: unknown check option 'modernize-lop-convert.UseCxx20ReverseRanges'; did you mean 'modernize-loop-convert.UseCxx20ReverseRanges' [-verify-config]
165ca68d58SNathan James // CHECK-VERIFY-DAG: command-line option '-config': warning: unknown check option 'StriceMode'; did you mean 'StrictMode' [-verify-config]
175b37cddfSCarlos Galvez // CHECK-VERIFY-DAG: command-line option '-config': warning: HeaderFileExtension 'hpp' is the same as ImplementationFileExtension 'hpp' [-verify-config]
185ca68d58SNathan James // CHECK-VERIFY: command-line option '-checks': warning: check glob 'bad*glob' doesn't match any known check [-verify-config]
195ca68d58SNathan James // CHECK-VERIFY: command-line option '-checks': warning: unknown check 'llvm-includeorder'; did you mean 'llvm-include-order' [-verify-config]
205ca68d58SNathan James // CHECK-VERIFY: command-line option '-checks': warning: unknown check 'my-made-up-check' [-verify-config]
21*f94ed6f7SFélix-Antoine Constantin 
22*f94ed6f7SFélix-Antoine Constantin // RUN: echo -e 'Checks: |\n bugprone-argument-comment\n bugprone-assert-side-effect,\n bugprone-bool-pointer-implicit-conversion\n readability-use-anyof*' > %T/MyClangTidyConfig
23*f94ed6f7SFélix-Antoine Constantin // RUN: clang-tidy -verify-config \
24*f94ed6f7SFélix-Antoine Constantin // RUN: --config-file=%T/MyClangTidyConfig | FileCheck %s -check-prefix=CHECK-VERIFY-BLOCK-OK
25*f94ed6f7SFélix-Antoine Constantin // CHECK-VERIFY-BLOCK-OK: No config errors detected.
26*f94ed6f7SFélix-Antoine Constantin 
27*f94ed6f7SFélix-Antoine Constantin // RUN: echo -e 'Checks: |\n bugprone-arguments-*\n bugprone-assert-side-effects\n bugprone-bool-pointer-implicit-conversion' > %T/MyClangTidyConfigBad
28*f94ed6f7SFélix-Antoine Constantin // RUN: not clang-tidy -verify-config \
29*f94ed6f7SFélix-Antoine Constantin // RUN: --config-file=%T/MyClangTidyConfigBad 2>&1 | FileCheck %s -check-prefix=CHECK-VERIFY-BLOCK-BAD
30*f94ed6f7SFélix-Antoine Constantin // CHECK-VERIFY-BLOCK-BAD: command-line option '-config': warning: check glob 'bugprone-arguments-*' doesn't match any known check [-verify-config]
31*f94ed6f7SFélix-Antoine Constantin // CHECK-VERIFY-BLOCK-BAD: command-line option '-config': warning: unknown check 'bugprone-assert-side-effects'; did you mean 'bugprone-assert-side-effect' [-verify-config]
32*f94ed6f7SFélix-Antoine Constantin 
33