1// RUN: rm -rf %T/clang-tidy/export-relpath
2// RUN: mkdir -p %T/clang-tidy/export-relpath/subdir
3// RUN: cp %s %T/clang-tidy/export-relpath/subdir/source.cpp
4// RUN: echo '[{ "directory": "%/T/clang-tidy/export-relpath/subdir", "command": "clang++ source.cpp", "file": "%/T/clang-tidy/export-relpath/subdir/source.cpp"}]' > %T/clang-tidy/export-relpath/subdir/compile_commands.json
5//
6// Check that running clang-tidy in './subdir' and storing results
7// in './fixes.yaml' works as expected.
8//
9// RUN: cd %T/clang-tidy/export-relpath
10// RUN: clang-tidy -p subdir subdir/source.cpp -checks='-*,google-explicit-constructor,llvm-namespace-comment' -export-fixes=./fixes.yaml
11// RUN: FileCheck -input-file=%T/clang-tidy/export-relpath/fixes.yaml -check-prefix=CHECK-YAML %s
12
13namespace i {
14void f(); // So that the namespace isn't empty.
15}
16// CHECK-YAML: ReplacementText: ' // namespace i'
17
18class A { A(int i); };
19// CHECK-YAML: ReplacementText: 'explicit '
20

source code of clang-tools-extra/test/clang-tidy/infrastructure/export-relpath.cpp