Debian Codegraph @

clang-tools-extra/include-cleaner/test/tool.cpp

raw
1 #include "foobar.h"
2
3 int x = foo();
4
5 // RUN: clang-include-cleaner -print=changes %s -- -I%S/Inputs/ | FileCheck --check-prefix=CHANGE %s
6 // CHANGE: - "foobar.h"
7 // CHANGE-NEXT: + "foo.h"
8
9 // RUN: clang-include-cleaner -remove=0 -print=changes %s -- -I%S/Inputs/ | FileCheck --check-prefix=INSERT %s
10 // INSERT-NOT: - "foobar.h"
11 // INSERT: + "foo.h"
12
13 // RUN: clang-include-cleaner -insert=0 -print=changes %s -- -I%S/Inputs/ | FileCheck --check-prefix=REMOVE %s
14 // REMOVE: - "foobar.h"
15 // REMOVE-NOT: + "foo.h"
16
17 // RUN: clang-include-cleaner -print=changes %s --ignore-headers="foobar\.h,foo\.h" -- -I%S/Inputs/ | FileCheck --match-full-lines --allow-empty --check-prefix=IGNORE %s
18 // IGNORE-NOT: - "foobar.h"
19 // IGNORE-NOT: + "foo.h"
20
21 // RUN: clang-include-cleaner -print=changes %s --ignore-headers="foobar.*\.h" -- -I%S/Inputs/ | FileCheck --match-full-lines --allow-empty --check-prefix=IGNORE2 %s
22 // IGNORE2-NOT: - "foobar.h"
23 // IGNORE2: + "foo.h"
24
25 // RUN: clang-include-cleaner -print=changes %s --ignore-headers= -- -I%S/Inputs/ | FileCheck --allow-empty --check-prefix=IGNORE3 %s
26 // IGNORE3: - "foobar.h"
27 // IGNORE3: + "foo.h"
28
29 // RUN: clang-include-cleaner -print=changes %s --only-headers="foo\.h" -- -I%S/Inputs/ | FileCheck --match-full-lines --allow-empty --check-prefix=ONLY %s
30 // ONLY-NOT: - "foobar.h"
31 // ONLY: + "foo.h"
32
33 // RUN: clang-include-cleaner -print=changes %s --only-headers= -- -I%S/Inputs/ | FileCheck --allow-empty --check-prefix=ONLY2 %s
34 // ONLY2: - "foobar.h"
35 // ONLY2: + "foo.h"
36
37 // RUN: clang-include-cleaner -print %s -- -I%S/Inputs/ | FileCheck --match-full-lines --check-prefix=PRINT %s
38 // PRINT: #include "foo.h"
39 // PRINT-NOT: {{^}}#include "foobar.h"{{$}}
40
41 // RUN: cp %s %t.cpp
42 // RUN: clang-include-cleaner -edit %t.cpp -- -I%S/Inputs/
43 // RUN: FileCheck --match-full-lines --check-prefix=EDIT %s < %t.cpp
44 // EDIT: #include "foo.h"
45 // EDIT-NOT: {{^}}#include "foobar.h"{{$}}
46
47 // RUN: cp %s %t.cpp
48 // RUN: clang-include-cleaner -edit --ignore-headers="foobar\.h,foo\.h" %t.cpp -- -I%S/Inputs/
49 // RUN: FileCheck --match-full-lines --check-prefix=EDIT2 %s < %t.cpp
50 // EDIT2-NOT: {{^}}#include "foo.h"{{$}}