aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-01-12 22:48:47 +0000
committerNico Weber <nicolasweber@gmx.de>2013-01-12 22:48:47 +0000
commite8ccc81a9f66361450148338b8457dd2c6ad11de (patch)
treeb7204807089db8294ea82393a4117f97b0ab805f /unittests/Format/FormatTest.cpp
parentd147f8fa3ef5dbebd1f24b72e52dedaebeaaa4b5 (diff)
Formatter: Prefer breaking before ObjC selector names over breaking at their ':'
Before: if ((self = [super initWithContentRect:contentRect styleMask: styleMask backing:NSBackingStoreBuffered defer:YES])) { Now: if ((self = [super initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:YES])) { git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172333 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 668e8af76b..cba25fcf8f 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1537,12 +1537,18 @@ TEST_F(FormatTest, FormatObjCMethodExpr) {
verifyFormat("throw [self errorFor:a];");
verifyFormat("@throw [self errorFor:a];");
- // The formatting of this isn't ideal yet. It tests that the formatter doesn't
- // break after "backing" but before ":", which would be at 80 columns.
+ // This tests that the formatter doesn't break after "backing" but before ":",
+ // which would be at 80 columns.
verifyFormat(
"void f() {\n"
- " if ((self = [super initWithContentRect:contentRect styleMask:\n"
- " styleMask backing:NSBackingStoreBuffered defer:YES]))");
+ " if ((self = [super initWithContentRect:contentRect styleMask:styleMask\n"
+ " backing:NSBackingStoreBuffered defer:YES]))");
+
+ verifyFormat("[foo setasdfasdffffffffffffadfasdfasdf:\n"
+ " [bar dowith:asdfdsfasdfasdfasfasfasfsafasdfsfad]];");
+
+ verifyFormat("[foo checkThatBreakingAfterColonWorksOk:\n"
+ " [bar ifItDoes:reduceOverallLineLengthLikeInThisCase]];");
}
@@ -1582,6 +1588,7 @@ TEST_F(FormatTest, ObjCAt) {
verifyFormat("@'c'");
verifyFormat("@true");
verifyFormat("NSNumber *smallestInt = @(-INT_MAX - 1);");
+ // FIXME: Array and dictionary literals need more work.
verifyFormat("@[");
verifyFormat("@{");