|
5 | 5 | // RUN: mkdir -p %t
|
6 | 6 | // RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %t/.clang-format
|
7 | 7 | // RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
|
8 |
| -// RUN: printf "\n" > %t/.clang-format |
| 8 | +// RUN: printf "Invalid:\n" > %t/.clang-format |
9 | 9 | // RUN: not clang-format -style=file -fallback-style=webkit -assume-filename=%t/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
|
10 | 10 | // RUN: rm %t/.clang-format
|
11 | 11 | // RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %t/_clang-format
|
|
20 | 20 | // Test yaml with no based style, and fallback style "none", LLVM formatting applied
|
21 | 21 | // RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | FileCheck -strict-whitespace -check-prefix=CHECK11 %s
|
22 | 22 |
|
| 23 | +// Empty config file tests |
| 24 | +// RUN: touch %t/.clang-format |
| 25 | +// RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK12 %s |
| 26 | +// RUN: rm %t/.clang-format |
| 27 | +// RUN: printf "\n" > %t/_clang-format |
| 28 | +// RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK13 %s |
| 29 | + |
23 | 30 | void f() {
|
24 | 31 | // CHECK1: {{^ int\* i;$}}
|
25 | 32 | // CHECK2: {{^ int \*i;$}}
|
26 | 33 | // CHECK3: Unknown value for BasedOnStyle: invalid
|
27 | 34 | // CHECK3: Error parsing -style: [[MSG]]
|
28 | 35 | // CHECK4: Error parsing -style: [[MSG]]
|
29 | 36 | // CHECK5: {{^ int\* i;$}}
|
| 37 | +// CHECK6: unknown key 'Invalid' |
30 | 38 | // CHECK6: {{^Error reading .*\.clang-format: (I|i)nvalid argument}}
|
31 | 39 | // CHECK7: {{^ int\* i;$}}
|
32 | 40 | // CHECK8: {{^ int\* i;$}}
|
33 | 41 | // CHECK9: {{^ int \*i;$}}
|
34 | 42 | // CHECK10: {{^ int \*i;$}}
|
35 | 43 | // CHECK11: {{^ int \*i;$}}
|
| 44 | +// CHECK12: {{^ int \*i;$}} |
| 45 | +// CHECK13: {{^ int \*i;$}} |
36 | 46 | int*i;
|
37 | 47 | int j;
|
38 | 48 | }
|
|
0 commit comments