summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-06-04 12:40:57 +0000
committerDaniel Jasper <djasper@google.com>2014-06-04 12:40:57 +0000
commita69ca9be127f26e22053243f7562d1079339314f (patch)
tree292fc64d2f53004064e8380d5e5182ef01894d65 /clang/unittests/Format/FormatTest.cpp
parent5d8d72c5df0b7b80b30a2d66acb7a03b7933bdc6 (diff)
downloadbcm5719-llvm-a69ca9be127f26e22053243f7562d1079339314f.tar.gz
bcm5719-llvm-a69ca9be127f26e22053243f7562d1079339314f.zip
clang-format: Leave empty lines within UnwrappedLines.
These are commonly used to structure things like enums or long braced lists. There doesn't seem to be a good reason to have the behavior in such structures be different from the behavior between statements. llvm-svn: 210183
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 40789640e25..cf5c9ff1efb 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1884,6 +1884,22 @@ TEST_F(FormatTest, FormatsEnum) {
verifyFormat("enum ShortEnum { A, B, C };");
verifyGoogleFormat("enum ShortEnum { A, B, C };");
+
+ EXPECT_EQ("enum KeepEmptyLines {\n"
+ " ONE,\n"
+ "\n"
+ " TWO,\n"
+ "\n"
+ " THREE\n"
+ "}",
+ format("enum KeepEmptyLines {\n"
+ " ONE,\n"
+ "\n"
+ " TWO,\n"
+ "\n"
+ "\n"
+ " THREE\n"
+ "}"));
}
TEST_F(FormatTest, FormatsEnumsWithErrors) {
@@ -2149,11 +2165,14 @@ TEST_F(FormatTest, StaticInitializers) {
// Here, everything other than the "}" would fit on a line.
verifyFormat("static int LooooooooooooooooooooooooongVariable[1] = {\n"
" 10000000000000000000000000};");
- EXPECT_EQ("S s = {a, b};", format("S s = {\n"
- " a,\n"
- "\n"
- " b\n"
- "};"));
+ EXPECT_EQ("S s = {a,\n"
+ "\n"
+ " b};",
+ format("S s = {\n"
+ " a,\n"
+ "\n"
+ " b\n"
+ "};"));
// FIXME: This would fit into the column limit if we'd fit "{ {" on the first
// line. However, the formatting looks a bit off and this probably doesn't
@@ -2457,7 +2476,6 @@ TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) {
"};",
format("class A : public QObject {\n"
" Q_Object\n"
- "\n"
" A() {\n}\n"
"} ;"));
}
OpenPOWER on IntegriCloud