diff options
Diffstat (limited to 'clang-tools-extra/test/clang-modernize/Compilations/compilation_not_inc.cpp')
| -rw-r--r-- | clang-tools-extra/test/clang-modernize/Compilations/compilation_not_inc.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-modernize/Compilations/compilation_not_inc.cpp b/clang-tools-extra/test/clang-modernize/Compilations/compilation_not_inc.cpp new file mode 100644 index 00000000000..b9be391107b --- /dev/null +++ b/clang-tools-extra/test/clang-modernize/Compilations/compilation_not_inc.cpp @@ -0,0 +1,24 @@ +// The following block tests: +// - A compilation database is detected from build path specified by -p but +// neither sources nor -include was provided. + +// Create directory structure +// a1, a2 and a3 are specified paths for files in the compilation database. +// RUN: rm -rf %T/CompilationNotInc +// RUN: mkdir -p %T/CompilationNotInc +// RUN: mkdir -p %T/CompilationNotInc/a1 +// RUN: mkdir -p %T/CompilationNotInc/a2 +// RUN: mkdir -p %T/CompilationNotInc/a3 + +// This test uses a compilation database +// RUN: sed -e 's#$(path)#%/T/CompilationNotInc#g' %S/Inputs/compile_commands.json > %T/CompilationNotInc/compile_commands.json + +// Check that no files are tranformed when -p is specified but not -include. +// RUN: cp %S/Inputs/compilations.cpp %T/DetectFromSource/a1 +// RUN: cp %S/Inputs/compilations.cpp %T/DetectFromSource/a2 +// RUN: cp %S/Inputs/compilations.cpp %T/DetectFromSource/a3 + +// RUN: not clang-modernize -use-nullptr -p=%T/CompilationNotInc +// RUN: not diff -b %T/compilations_expected.cpp %T/CompilationNotInc/a1/compilations.cpp +// RUN: not diff -b %T/compilations_expected.cpp %T/CompilationNotInc/a2/compilations.cpp +// RUN: not diff -b %T/compilations_expected.cpp %T/CompilationNotInc/a3/compilations.cpp |

