aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-10 14:36:46 +0000
committerManuel Klimek <klimek@google.com>2013-01-10 14:36:46 +0000
commit2851c16443dcdb9d8bb509d321fb827a560b47bc (patch)
treebb45e9583ce8cc7f41f72a5704200700e394842d /unittests/Format/FormatTest.cpp
parent36fab8d70eee342d66e03c9b09c029f126196103 (diff)
Fixes formatting of function calls etc inside an initializer list.
We're now formatting (column limit 25): int x = { avariable, b(alongervariable) }; This also fixes: Aaa({ int i; }, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccc)); ... where we would previously break after the '},'. Putting the closing curly into an extra line when there's a break directly after the first curly will be done in a subsequent patch. Paired with djasper. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172070 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 7a16da5bb2..439568e471 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1117,6 +1117,21 @@ TEST_F(FormatTest, IncorrectCodeErrorDetection) {
}
+TEST_F(FormatTest, LayoutCallsInsideBraceInitializers) {
+ verifyFormat(
+ "int x = {\n"
+ " avariable,\n"
+ " b(alongervariable) };", getLLVMStyleWithColumns(25));
+}
+
+TEST_F(FormatTest, LayoutTokensFollowingBlockInParentheses) {
+ verifyFormat(
+ "Aaa({\n"
+ " int i;\n"
+ "}, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,\n"
+ " ccccccccccccccccc));");
+}
+
//===----------------------------------------------------------------------===//
// Objective-C tests.
//===----------------------------------------------------------------------===//