summaryrefslogtreecommitdiff
path: root/clang-tools-extra/test
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-11-28 14:43:26 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-11-28 14:43:26 +0000
commitaded6828c379bb129cadeb1fdd04097cefe4e29b (patch)
tree43ff27e823c5e59dbf9eee8a53b0cf06ca53bd57 /clang-tools-extra/test
parentc0741c92cd09327d2b04ef7ff1fb7b8333236d44 (diff)
[clang-tidy] Added a test -export-fixes with relative paths.
Summary: A test for D51864. Reviewers: ioeric, steveire Reviewed By: steveire Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D51865
Diffstat (limited to 'clang-tools-extra/test')
-rw-r--r--clang-tools-extra/test/clang-tidy/export-relpath.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/export-relpath.cpp b/clang-tools-extra/test/clang-tidy/export-relpath.cpp
new file mode 100644
index 00000000000..872830d42e9
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/export-relpath.cpp
@@ -0,0 +1,19 @@
+// RUN: rm -rf %T/clang-tidy/export-relpath
+// RUN: mkdir -p %T/clang-tidy/export-relpath/subdir
+// RUN: cp %s %T/clang-tidy/export-relpath/subdir/source.cpp
+// 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
+//
+// Check that running clang-tidy in './subdir' and storing results
+// in './fixes.yaml' works as expected.
+//
+// RUN: cd %T/clang-tidy/export-relpath
+// RUN: clang-tidy -p subdir subdir/source.cpp -checks='-*,google-explicit-constructor,llvm-namespace-comment' -export-fixes=./fixes.yaml
+// RUN: FileCheck -input-file=%T/clang-tidy/export-relpath/fixes.yaml -check-prefix=CHECK-YAML %s
+
+namespace i {
+void f(); // So that the namespace isn't empty.
+}
+// CHECK-YAML: ReplacementText: ' // namespace i'
+
+class A { A(int i); };
+// CHECK-YAML: ReplacementText: 'explicit '