Add PR check to suggest alternatives to using undef (#118506)
[llvm-project.git] / clang / test / Format / clang-format-ignore.cpp
blob67d68aebde5d0499378677ac81d210228b927096
1 // RUN: rm -rf %t.dir
2 // RUN: mkdir -p %t.dir/level1/level2
4 // RUN: cd %t.dir
5 // RUN: echo "*" > .clang-format-ignore
6 // RUN: echo "level*/*.c*" >> .clang-format-ignore
7 // RUN: echo "*/*2/foo.*" >> .clang-format-ignore
8 // RUN: touch foo.cc
9 // RUN: clang-format -verbose .clang-format-ignore foo.cc 2>&1 \
10 // RUN: | FileCheck %s -allow-empty
12 // RUN: cd level1
13 // RUN: touch bar.cc baz.c
14 // RUN: clang-format -verbose bar.cc baz.c 2>&1 | FileCheck %s -allow-empty
16 // RUN: cd level2
17 // RUN: touch foo.c foo.js
18 // RUN: clang-format -verbose foo.c foo.js 2>&1 | FileCheck %s -allow-empty
20 // CHECK-NOT: Formatting
22 // RUN: touch .clang-format-ignore
23 // RUN: clang-format -verbose foo.c foo.js 2>&1 \
24 // RUN: | FileCheck %s -check-prefix=CHECK2 -match-full-lines
25 // CHECK2: Formatting [1/2] foo.c
26 // CHECK2-NEXT: Formatting [2/2] foo.js
28 // RUN: echo "*.js" > .clang-format-ignore
29 // RUN: clang-format -verbose foo.c foo.js 2>&1 \
30 // RUN: | FileCheck %s -check-prefix=CHECK3 -match-full-lines
31 // CHECK3: Formatting [1/2] foo.c
32 // CHECK3-NOT: foo.js
34 // RUN: cd ../..
35 // RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2>&1 \
36 // RUN: | FileCheck %s -check-prefix=CHECK4 -match-full-lines
37 // CHECK4: {{Formatting \[1/5] .*foo\.c}}
38 // CHECK4-NOT: foo.js
40 // RUN: rm .clang-format-ignore
41 // RUN: clang-format -verbose *.cc level1/*.c* level1/level2/foo.* 2>&1 \
42 // RUN: | FileCheck %s -check-prefix=CHECK5 -match-full-lines
43 // CHECK5: {{Formatting \[1/5] .*foo\.cc}}
44 // CHECK5-NEXT: {{Formatting \[2/5] .*bar\.cc}}
45 // CHECK5-NEXT: {{Formatting \[3/5] .*baz\.c}}
46 // CHECK5-NEXT: {{Formatting \[4/5] .*foo\.c}}
47 // CHECK5-NOT: foo.js
49 // RUN: echo "foo.*" > .clang-format-ignore
50 // RUN: echo "int i ;" > foo.c
51 // RUN: clang-format -assume-filename=foo.c < foo.c \
52 // RUN: | FileCheck %s -check-prefix=CHECK6 -allow-empty
53 // CHECK6-NOT: int
55 // RUN: clang-format -assume-filename=bar.c < foo.c \
56 // RUN: | FileCheck %s -check-prefix=CHECK7 -match-full-lines
57 // CHECK7: int i;
59 // RUN: cd ..
60 // RUN: rm -r %t.dir