aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-10 15:58:26 +0000
committerManuel Klimek <klimek@google.com>2013-01-10 15:58:26 +0000
commitc8c8a478639f1474f4c53d12befc405934083633 (patch)
tree9e42dac1e0f58717065b29cfc9672d029603d553 /unittests/Format/FormatTest.cpp
parent3048aeae0654b34dcae561494c1b28872c88a5c8 (diff)
Fixes layout of right braces.
We now decide whether a newline should go before the closing brace depending on whether a newline was inserted after the opening brace. For example, we now insert a newline before '};' in: static SomeClass WithALoooooooooooooooooooongName = { 100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" }; ... while not inserting a newline here: static SomeClass = { a, b, c, d, e, f, g, h, i, j, looooooooooooooooooooooooooooooooooongname, looooooooooooooooooooooooooooooong }; Also fixes the formating of (column limit 25): int x = { avariable, b(alongervariable) }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172076 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 439568e471..1d9363dc2e 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -430,7 +430,13 @@ TEST_F(FormatTest, StaticInitializers) {
// FIXME: Format like enums if the static initializer does not fit on a line.
verifyFormat(
"static SomeClass WithALoooooooooooooooooooongName = {\n"
- " 100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" };");
+ " 100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n"
+ "};");
+
+ verifyFormat(
+ "static SomeClass = { a, b, c, d, e, f, g, h, i, j,\n"
+ " looooooooooooooooooooooooooooooooooongname,\n"
+ " looooooooooooooooooooooooooooooong };");
}
TEST_F(FormatTest, FormatsSmallMacroDefinitionsInSingleLine) {
@@ -1121,7 +1127,8 @@ TEST_F(FormatTest, LayoutCallsInsideBraceInitializers) {
verifyFormat(
"int x = {\n"
" avariable,\n"
- " b(alongervariable) };", getLLVMStyleWithColumns(25));
+ " b(alongervariable)\n"
+ "};", getLLVMStyleWithColumns(25));
}
TEST_F(FormatTest, LayoutTokensFollowingBlockInParentheses) {