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 | d519dc975cf544718d9a46a63ec57cc7727cada2 (patch) | |
tree | 4e9da2ff339910d9033d101fa10fae942f0f6494 /unittests | |
parent | 9e6a299419ec5b0a4b08ae13d2c4b1170293222b (diff) | |
download | clang-d519dc975cf544718d9a46a63ec57cc7727cada2.tar.gz clang-d519dc975cf544718d9a46a63ec57cc7727cada2.tar.bz2 clang-d519dc975cf544718d9a46a63ec57cc7727cada2.tar.xz |
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
}];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209720 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 94d4bbb00e..8ad59cd93e 100644 --- a/unittests/Format/FormatTest.cpp +++ b/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" |