Current.PackingKind == PPK_Inconclusive)));
// If this '[' opens an ObjC call, determine whether all parameters fit
// into one line and put one per line if they don't.
- if (Current.Type == TT_ObjCMethodExpr &&
+ if (Current.Type == TT_ObjCMethodExpr && Style.ColumnLimit != 0 &&
getLengthToMatchingParen(Current) + State.Column >
getColumnLimit(State))
BreakBeforeParameter = true;
Style));
// Keep empty and one-element array literals on a single line.
- verifyFormat("NSArray* a = [[NSArray alloc] initWithArray:@[]\n"
- " copyItems:YES];",
- Style);
- verifyFormat("NSArray* a = [[NSArray alloc] initWithArray:@[ @\"a\" ]\n"
- " copyItems:YES];",
- Style);
+ EXPECT_EQ("NSArray* a = [[NSArray alloc] initWithArray:@[]\n"
+ " copyItems:YES];",
+ format("NSArray*a=[[NSArray alloc] initWithArray:@[]\n"
+ "copyItems:YES];",
+ Style));
+ EXPECT_EQ("NSArray* a = [[NSArray alloc] initWithArray:@[ @\"a\" ]\n"
+ " copyItems:YES];",
+ format("NSArray*a=[[NSArray alloc]initWithArray:@[ @\"a\" ]\n"
+ " copyItems:YES];",
+ Style));
EXPECT_EQ("NSArray* a = [[NSArray alloc] initWithArray:@[\n"
" @\"a\",\n"
" @\"a\"\n"
" ]\n"
" copyItems:YES];",
Style));
- verifyFormat(
+ EXPECT_EQ(
"NSArray* a = [[NSArray alloc] initWithArray:@[ @\"a\", @\"a\" ]\n"
" copyItems:YES];",
- Style);
+ format("NSArray* a = [[NSArray alloc] initWithArray:@[ @\"a\", @\"a\" ]\n"
+ " copyItems:YES];",
+ Style));
+
+ verifyFormat("[self.a b:c c:d];", Style);
+ EXPECT_EQ("[self.a b:c\n"
+ " c:d];",
+ format("[self.a b:c\n"
+ "c:d];",
+ Style));
}
TEST_F(FormatTest, FormatsLambdas) {