diff options
| author | Alexander Kornienko <alexfh@google.com> | 2013-05-19 00:53:30 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2013-05-19 00:53:30 +0000 |
| commit | 006b5c89cec1ae5de19bcbef71c04c74754594fb (patch) | |
| tree | 3330dbe770316ce2fe22e9666044acc88ef5707e /clang/test | |
| parent | 8cfbaa6988282d52f17b2ddb2944582804bbc247 (diff) | |
| download | bcm5719-llvm-006b5c89cec1ae5de19bcbef71c04c74754594fb.tar.gz bcm5719-llvm-006b5c89cec1ae5de19bcbef71c04c74754594fb.zip | |
Clang-format: allow -style="{yaml/json}" on command line
Summary: + improved handling of default style and predefined styles.
Reviewers: djasper, klimek
Reviewed By: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D813
llvm-svn: 182205
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Format/style-on-command-line.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Format/style-on-command-line.cpp b/clang/test/Format/style-on-command-line.cpp new file mode 100644 index 00000000000..679236f7a46 --- /dev/null +++ b/clang/test/Format/style-on-command-line.cpp @@ -0,0 +1,23 @@ +// RUN: grep -Ev "// *[A-Z0-9]+:" %s > %t.cpp +// 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 +// RUN: clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s +// RUN: clang-format -style="{lsjd}" %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s +// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format +// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s +// RUN: echo -e "BasedOnStyle: google\nIndentWidth: 5" > %T/.clang-format +// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s +void f() { +// CHECK1: {{^ int\* i;$}} +// CHECK2: {{^ int \*i;$}} +// CHECK3: Unknown value for BasedOnStyle: invalid +// CHECK3: Error parsing -style: Invalid argument, using LLVM style +// CHECK3: {{^ int \*i;$}} +// CHECK4: Error parsing -style: Invalid argument, using LLVM style +// CHECK4: {{^ int \*i;$}} +// CHECK5: Can't find usable .clang-format, using LLVM style +// CHECK5: {{^ int \*i;$}} +// CHECK6: {{^ int\* i;$}} +int*i; +int j; +} |

