blob: 044264b916053a0ed1c3583bf420f0d17fdb38c8 [file] [log] [blame]
Alexander Kornienko006b5c82013-05-19 00:53:30 +00001// 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
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
Alexander Kornienko006b5c82013-05-19 00:53:30 +000011void f() {
12// CHECK1: {{^ int\* i;$}}
13// CHECK2: {{^ int \*i;$}}
14// CHECK3: Unknown value for BasedOnStyle: invalid
15// CHECK3: Error parsing -style: Invalid argument, using LLVM style
16// CHECK3: {{^ int \*i;$}}
17// CHECK4: Error parsing -style: Invalid argument, using LLVM style
18// CHECK4: {{^ int \*i;$}}
Chandler Carruthbc36e6e02013-09-02 07:42:02 +000019// CHECK5: {{^ int\* i;$}}
Alexander Kornienko9acf3db2013-09-02 13:44:16 +000020// CHECK6: Can't find usable .clang-format, using LLVM style
21// CHECK6: {{^ int \*i;$}}
Alexander Kornienko006b5c82013-05-19 00:53:30 +000022int*i;
23int j;
24}