summaryrefslogtreecommitdiffstats
path: root/test/Format/style-on-command-line.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
committerdim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
commit952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch)
treedf8df0b0067b381eab470a3b8f28d14a552a6340 /test/Format/style-on-command-line.cpp
parentea266cad53e3d49771fa38103913d3ec7a166694 (diff)
downloadFreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip
FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/Format/style-on-command-line.cpp')
-rw-r--r--test/Format/style-on-command-line.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Format/style-on-command-line.cpp b/test/Format/style-on-command-line.cpp
new file mode 100644
index 0000000..22131a1
--- /dev/null
+++ b/test/Format/style-on-command-line.cpp
@@ -0,0 +1,29 @@
+// 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: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format
+// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
+// RUN: printf "\n" > %T/.clang-format
+// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
+// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format
+// RUN: [ ! -e %T/_clang-format ] || rm %T/_clang-format
+// 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
+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: {{^ int\* i;$}}
+// CHECK6: {{^Error reading .*\.clang-format: Invalid argument}}
+// XCHECK6X: {{^ int \*i;$}}
+// CHECK7: {{^ int\* i;$}}
+int*i;
+int j;
+}
OpenPOWER on IntegriCloud