[PATCH] D20159: [include-fixer] Add lit-test for relative include path.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 05:36:51 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL269177: [include-fixer] Add lit-test for relative include path. (authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D20159?vs=56884&id=56886#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20159

Files:
  clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json
  clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml
  clang-tools-extra/trunk/test/include-fixer/include_path.cpp

Index: clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json
===================================================================
--- clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json
+++ clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json
@@ -0,0 +1,7 @@
+[
+{
+  "directory": "test_dir/build",
+  "command": "clang++ -I../include -o bar.o test_dir/src/bar.cpp",
+  "file": "test_dir/src/bar.cpp"
+}
+]
Index: clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml
===================================================================
--- clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml
+++ clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml
@@ -9,3 +9,14 @@
 LineNumber:      1
 Type:            Class
 ...
+---
+Name:           bar
+Contexts:
+  - ContextType:     Namespace
+    ContextName:     a
+  - ContextType:     Namespace
+    ContextName:     b
+FilePath:        ../include/bar.h
+LineNumber:      1
+Type:            Class
+...
Index: clang-tools-extra/trunk/test/include-fixer/include_path.cpp
===================================================================
--- clang-tools-extra/trunk/test/include-fixer/include_path.cpp
+++ clang-tools-extra/trunk/test/include-fixer/include_path.cpp
@@ -0,0 +1,14 @@
+// REQUIRES: shell
+// RUN: mkdir -p %T/include-fixer/include
+// RUN: mkdir -p %T/include-fixer/build
+// RUN: mkdir -p %T/include-fixer/src
+// RUN: sed 's|test_dir|%T/include-fixer|g' %S/Inputs/database_template.json > %T/include-fixer/build/compile_commands.json
+// RUN: cp %S/Inputs/fake_yaml_db.yaml %T/include-fixer/build/fake_yaml_db.yaml
+// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: touch %T/include-fixer/include/bar.h
+// RUN: cd %T/include-fixer/build
+// RUN: clang-include-fixer -db=yaml -input=fake_yaml_db.yaml -p=. %T/include-fixer/src/bar.cpp
+// RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
+
+// CHECK: #include "bar.h"
+// CHECK: b::a::bar f;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20159.56886.patch
Type: text/x-patch
Size: 2036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160511/8fd60f09/attachment.bin>


More information about the cfe-commits mailing list