blob: 7fd61341c5abaf3787b47a2fdb7bf1491a84daa7 [file] [log] [blame]
Alexander Kornienko22479f72013-09-02 14:25:56 +00001// RUN: grep -Ev "// *[A-Z0-9_]+:" %s > %t.cpp
Alexander Kornienko006b5c82013-05-19 00:53:30 +00002// 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
Daniel Dunbar14e88a12013-08-29 03:02:39 +00007// RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format
Chandler Carruthbc36e6e02013-09-02 07:42:02 +00008// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
Alexander Kornienko9acf3db2013-09-02 13:44:16 +00009// RUN: printf "\n" > %T/.clang-format
10// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
Hans Wennborg9f6581b2013-09-10 15:41:12 +000011// 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
Alexander Kornienko006b5c82013-05-19 00:53:30 +000015void 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;$}}
Chandler Carruthbc36e6e02013-09-02 07:42:02 +000023// CHECK5: {{^ int\* i;$}}
Alexander Kornienko22479f72013-09-02 14:25:56 +000024// CHECK6: {{^Error reading .*\.clang-format: Invalid argument}}
Alexander Kornienko9acf3db2013-09-02 13:44:16 +000025// CHECK6: {{^ int \*i;$}}
Hans Wennborg9f6581b2013-09-10 15:41:12 +000026// CHECK7: {{^ int\* i;$}}
Alexander Kornienko006b5c82013-05-19 00:53:30 +000027int*i;
28int j;
29}