]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Format/style-on-command-line.cpp
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
[FreeBSD/FreeBSD.git] / test / Format / style-on-command-line.cpp
1 // RUN: grep -Ev "// *[A-Z0-9_]+:" %s > %t.cpp
2 // RUN: clang-format -style="{BasedOnStyle: Google, IndentWidth: 8}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
3 // RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
4 // RUN: clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s
5 // RUN: clang-format -style="{lsjd}" %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s
6 // RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format
7 // RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format
8 // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
9 // RUN: printf "\n" > %T/.clang-format
10 // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
11 // RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format
12 // RUN: [ ! -e %T/_clang-format ] || rm %T/_clang-format
13 // RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %T/_clang-format
14 // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
15 void f() {
16 // CHECK1: {{^        int\* i;$}}
17 // CHECK2: {{^       int \*i;$}}
18 // CHECK3: Unknown value for BasedOnStyle: invalid
19 // CHECK3: Error parsing -style: Invalid argument, using LLVM style
20 // CHECK3: {{^  int \*i;$}}
21 // CHECK4: Error parsing -style: Invalid argument, using LLVM style
22 // CHECK4: {{^  int \*i;$}}
23 // CHECK5: {{^     int\* i;$}}
24 // CHECK6: {{^Error reading .*\.clang-format: Invalid argument}}
25 // XCHECK6X: {{^  int \*i;$}}
26 // CHECK7: {{^      int\* i;$}}
27 int*i;
28 int j;
29 }