1f4a2713aSLionel Sambuc // RUN: grep -Ev "// *[A-Z0-9_]+:" %s > %t.cpp
2f4a2713aSLionel Sambuc // RUN: clang-format -style="{BasedOnStyle: Google, IndentWidth: 8}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
3f4a2713aSLionel Sambuc // RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
4*0a6a1f1dSLionel Sambuc // RUN: clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" -fallback-style=LLVM %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s
5*0a6a1f1dSLionel Sambuc // RUN: clang-format -style="{lsjd}" %t.cpp -fallback-style=LLVM 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s
6f4a2713aSLionel Sambuc // RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format
7f4a2713aSLionel Sambuc // RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format
8f4a2713aSLionel Sambuc // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
9f4a2713aSLionel Sambuc // RUN: printf "\n" > %T/.clang-format
10*0a6a1f1dSLionel Sambuc // RUN: clang-format -style=file -fallback-style=webkit %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
11f4a2713aSLionel Sambuc // RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format
12f4a2713aSLionel Sambuc // RUN: [ ! -e %T/_clang-format ] || rm %T/_clang-format
13f4a2713aSLionel Sambuc // RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %T/_clang-format
14f4a2713aSLionel Sambuc // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
15*0a6a1f1dSLionel Sambuc // RUN: clang-format -style="{BasedOnStyle: LLVM, PointerBindsToType: true}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK8 %s
16*0a6a1f1dSLionel Sambuc // RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK9 %s
f()17f4a2713aSLionel Sambuc void f() {
18f4a2713aSLionel Sambuc // CHECK1: {{^ int\* i;$}}
19f4a2713aSLionel Sambuc // CHECK2: {{^ int \*i;$}}
20f4a2713aSLionel Sambuc // CHECK3: Unknown value for BasedOnStyle: invalid
21*0a6a1f1dSLionel Sambuc // CHECK3: Error parsing -style: {{I|i}}nvalid argument, using LLVM style
22f4a2713aSLionel Sambuc // CHECK3: {{^ int \*i;$}}
23*0a6a1f1dSLionel Sambuc // CHECK4: Error parsing -style: {{I|i}}nvalid argument, using LLVM style
24f4a2713aSLionel Sambuc // CHECK4: {{^ int \*i;$}}
25f4a2713aSLionel Sambuc // CHECK5: {{^ int\* i;$}}
26*0a6a1f1dSLionel Sambuc // CHECK6: {{^Error reading .*\.clang-format: (I|i)nvalid argument}}
27*0a6a1f1dSLionel Sambuc // CHECK6: {{^Can't find usable .clang-format, using webkit style$}}
28*0a6a1f1dSLionel Sambuc // CHECK6: {{^ int\* i;$}}
29f4a2713aSLionel Sambuc // CHECK7: {{^ int\* i;$}}
30*0a6a1f1dSLionel Sambuc // CHECK8: {{^ int\* i;$}}
31*0a6a1f1dSLionel Sambuc // CHECK9: {{^ int \*i;$}}
32f4a2713aSLionel Sambuc int*i;
33f4a2713aSLionel Sambuc int j;
34f4a2713aSLionel Sambuc }
35