Author: hokein Date: Wed May 11 07:30:45 2016 New Revision: 269177 URL: http://llvm.org/viewvc/llvm-project?rev=269177&view=rev Log: [include-fixer] Add lit-test for relative include path.
Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20159 Added: clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json clang-tools-extra/trunk/test/include-fixer/include_path.cpp Modified: clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml Added: clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json?rev=269177&view=auto ============================================================================== --- clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json (added) +++ clang-tools-extra/trunk/test/include-fixer/Inputs/database_template.json Wed May 11 07:30:45 2016 @@ -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" +} +] Modified: clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml?rev=269177&r1=269176&r2=269177&view=diff ============================================================================== --- clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml (original) +++ clang-tools-extra/trunk/test/include-fixer/Inputs/fake_yaml_db.yaml Wed May 11 07:30:45 2016 @@ -9,3 +9,14 @@ FilePath: foo.h LineNumber: 1 Type: Class ... +--- +Name: bar +Contexts: + - ContextType: Namespace + ContextName: a + - ContextType: Namespace + ContextName: b +FilePath: ../include/bar.h +LineNumber: 1 +Type: Class +... Added: clang-tools-extra/trunk/test/include-fixer/include_path.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/include-fixer/include_path.cpp?rev=269177&view=auto ============================================================================== --- clang-tools-extra/trunk/test/include-fixer/include_path.cpp (added) +++ clang-tools-extra/trunk/test/include-fixer/include_path.cpp Wed May 11 07:30:45 2016 @@ -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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits