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;