diff options
| author | Daniel Jasper <djasper@google.com> | 2014-05-28 09:11:53 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-05-28 09:11:53 +0000 |
| commit | 335ff26631b142d56b2954e37c51c2a979a34c53 (patch) | |
| tree | a91bc5e2587ea14e23860f1561856f004a2ead14 /clang/unittests/Format/FormatTest.cpp | |
| parent | 82ee0433da3c2d2f2eb9f46f80c463f71bb75c29 (diff) | |
| download | bcm5719-llvm-335ff26631b142d56b2954e37c51c2a979a34c53.tar.gz bcm5719-llvm-335ff26631b142d56b2954e37c51c2a979a34c53.zip | |
clang-format: Format array and dict literals similar to blocks.
Especially, reduce the amount of indentation if it doesn't increase
readability.
Before:
NSMutableDictionary* dictionary = [NSMutableDictionary
dictionaryWithDictionary:@{
aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbb : bbbbb,
cccccccccccccccc : ccccccccccccccc
}];
After:
NSMutableDictionary* dictionary =
[NSMutableDictionary dictionaryWithDictionary:@{
aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbb : bbbbb,
cccccccccccccccc : ccccccccccccccc
}];
llvm-svn: 209720
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 94d4bbb00ef..8ad59cd93e1 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -6491,6 +6491,12 @@ TEST_F(FormatTest, ObjCDictLiterals) { " @\"dte\" : [NSDate date],\n" " @\"processInfo\" : [NSProcessInfo processInfo]\n" "};"); + verifyFormat("NSMutableDictionary *dictionary =\n" + " [NSMutableDictionary dictionaryWithDictionary:@{\n" + " aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa,\n" + " bbbbbbbbbbbbbbbbbb : bbbbb,\n" + " cccccccccccccccc : ccccccccccccccc\n" + " }];"); } TEST_F(FormatTest, ObjCArrayLiterals) { @@ -8590,10 +8596,12 @@ TEST_F(FormatTest, FormatsWithWebKitStyle) { format("NSArray*a=[[NSArray alloc]initWithArray:@[ @\"a\" ]\n" " copyItems:YES];", Style)); + // FIXME: This does not seem right, there should be more indentation before + // the array literal's entries. Nested blocks have the same problem. EXPECT_EQ("NSArray* a = [[NSArray alloc] initWithArray:@[\n" - " @\"a\",\n" - " @\"a\"\n" - " ]\n" + " @\"a\",\n" + " @\"a\"\n" + "]\n" " copyItems:YES];", format("NSArray* a = [[NSArray alloc] initWithArray:@[\n" " @\"a\",\n" |

