aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-02-05 15:25:34 +0000
committerManuel Klimek <klimek@google.com>2013-02-05 15:25:34 +0000
commit4696b4e1b2fc08845434bd8d24807597a3549c00 (patch)
treea76e6b99d45b35da28d3818b60da1e55a9730302 /test
parent5a871a0706547cb60f47d8a8dddcc1f3a26bdbbc (diff)
Implements support for specifying multiple ranges.
This is backwards compatible with earlier integrations. Also adds a basic test and a test for the ranges integration. You can now run: clang-format -offset=42 -length=15 -offset=150 -length=22 To re-format the ranges (42, +15) and (150, +22). git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@174378 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/clang-format/basic.cpp6
-rw-r--r--test/clang-format/ranges.cpp11
2 files changed, 17 insertions, 0 deletions
diff --git a/test/clang-format/basic.cpp b/test/clang-format/basic.cpp
new file mode 100644
index 00000000..faea485d
--- /dev/null
+++ b/test/clang-format/basic.cpp
@@ -0,0 +1,6 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: clang-format -i %t.cpp
+// RUN: FileCheck -input-file=%t.cpp %s
+
+// CHECK: {{^int \*i;}}
+ int * i ;
diff --git a/test/clang-format/ranges.cpp b/test/clang-format/ranges.cpp
new file mode 100644
index 00000000..d6957aa2
--- /dev/null
+++ b/test/clang-format/ranges.cpp
@@ -0,0 +1,11 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: clang-format -offset=2 -length=0 -offset=28 -length=0 -i %t.cpp
+// RUN: FileCheck -input-file=%t.cpp %s
+// CHECK: {{^int \*i;$}}
+ int*i;
+
+// CHECK: {{^ int \* i;$}}
+ int * i;
+
+// CHECK: {{^int \*i;$}}
+ int * i;