2013-09-02 22:25:56 +08:00
|
|
|
// RUN: grep -Ev "// *[A-Z0-9_]+:" %s > %t.cpp
|
2013-05-19 08:53:30 +08:00
|
|
|
// RUN: clang-format -style="{BasedOnStyle: Google, IndentWidth: 8}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
|
|
|
|
// RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
|
2013-12-03 14:48:41 +08:00
|
|
|
// RUN: clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" -fallback-style=LLVM %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s
|
|
|
|
// RUN: clang-format -style="{lsjd}" %t.cpp -fallback-style=LLVM 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s
|
2013-08-29 11:02:39 +08:00
|
|
|
// RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format
|
2013-09-02 15:42:02 +08:00
|
|
|
// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
|
2013-09-02 21:44:16 +08:00
|
|
|
// RUN: printf "\n" > %T/.clang-format
|
2013-12-02 23:21:38 +08:00
|
|
|
// RUN: clang-format -style=file -fallback-style=webkit %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
|
2015-06-09 20:41:02 +08:00
|
|
|
// RUN: rm %T/.clang-format
|
2013-09-10 23:41:12 +08:00
|
|
|
// RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %T/_clang-format
|
|
|
|
// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
|
2014-06-17 20:40:34 +08:00
|
|
|
// RUN: clang-format -style="{BasedOnStyle: LLVM, PointerBindsToType: true}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK8 %s
|
|
|
|
// RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK9 %s
|
2013-05-19 08:53:30 +08:00
|
|
|
void f() {
|
|
|
|
// CHECK1: {{^ int\* i;$}}
|
|
|
|
// CHECK2: {{^ int \*i;$}}
|
|
|
|
// CHECK3: Unknown value for BasedOnStyle: invalid
|
2014-06-12 20:40:04 +08:00
|
|
|
// CHECK3: Error parsing -style: {{I|i}}nvalid argument, using LLVM style
|
2013-05-19 08:53:30 +08:00
|
|
|
// CHECK3: {{^ int \*i;$}}
|
2014-06-12 20:40:04 +08:00
|
|
|
// CHECK4: Error parsing -style: {{I|i}}nvalid argument, using LLVM style
|
2013-05-19 08:53:30 +08:00
|
|
|
// CHECK4: {{^ int \*i;$}}
|
2013-09-02 15:42:02 +08:00
|
|
|
// CHECK5: {{^ int\* i;$}}
|
2014-06-12 20:40:04 +08:00
|
|
|
// CHECK6: {{^Error reading .*\.clang-format: (I|i)nvalid argument}}
|
2013-12-02 23:21:38 +08:00
|
|
|
// CHECK6: {{^ int\* i;$}}
|
2013-09-10 23:41:12 +08:00
|
|
|
// CHECK7: {{^ int\* i;$}}
|
2014-06-17 20:40:34 +08:00
|
|
|
// CHECK8: {{^ int\* i;$}}
|
|
|
|
// CHECK9: {{^ int \*i;$}}
|
2013-05-19 08:53:30 +08:00
|
|
|
int*i;
|
|
|
|
int j;
|
|
|
|
}
|