aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-03-07 20:50:00 +0000
committerDaniel Jasper <djasper@google.com>2013-03-07 20:50:00 +0000
commitf302354a7d1a63186fb0d9aa600ce3257be1f690 (patch)
tree8796a9931027a170f05f930ae1d41de9cb307fa7 /unittests/Format/FormatTest.cpp
parentf4b48042724d2253d0426cadcb93e24eeb47e264 (diff)
Remove unncessary whitespace when triggered on empty line.
With the cursor located at "I", clang-format would not do anything to: int a; I int b; With this patch, it reduces the number of empty lines as necessary, and removes unnecessary whitespace. It does not change/reformat "int a;" or "int b;". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176650 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index eafc4c8512..1e92592488 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -194,6 +194,13 @@ TEST_F(FormatTest, FormatsCorrectRegionForLeadingWhitespace) {
25, 0, getLLVMStyleWithColumns(12)));
}
+TEST_F(FormatTest, RemovesWhitespaceWhenTriggeredOnEmptyLine) {
+ EXPECT_EQ("int a;\n\n int b;",
+ format("int a;\n \n\n int b;", 7, 0, getLLVMStyle()));
+ EXPECT_EQ("int a;\n\n int b;",
+ format("int a;\n \n\n int b;", 9, 0, getLLVMStyle()));
+}
+
TEST_F(FormatTest, ReformatsMovedLines) {
EXPECT_EQ(
"template <typename T> T *getFETokenInfo() const {\n"