From 0448b4dd872f37193fdc5099daa31277527b15a5 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sun, 10 Feb 2013 20:48:24 +0000 Subject: [PATCH] Formatter: Add a test for multi-line ObjC dict literals. As it turns out, this already works reasonably well. This example from http://clang.llvm.org/docs/ObjectiveCLiterals.html NSDictionary *dictionary = @{ @"name" : NSUserName(), @"date" : [NSDate date], @"processInfo" : [NSProcessInfo processInfo] }; is formatted like NSDictionary *dictionary = @{ @"name" : NSUserName(), @"date" : [NSDate date], @"processInfo" : [NSProcessInfo processInfo] }; There's already a FIXME in NestedStaticInitializers about supporting one initializer per line, which is really all that's missing here too. llvm-svn: 174842 --- clang/unittests/Format/FormatTest.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 3760a3b..12a3715 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -2563,6 +2563,9 @@ TEST_F(FormatTest, ObjCLiterals) { "NSDictionary *settings = @{ AVEncoderKey : @(AVAudioQualityMax) };"); // FIXME: Nested and multi-line array and dictionary literals need more work. + verifyFormat( + "NSDictionary *d = @{ @\"nam\" : NSUserNam(), @\"dte\" : [NSDate date],\n" + " @\"processInfo\" : [NSProcessInfo processInfo] };"); } TEST_F(FormatTest, ReformatRegionAdjustsIndent) { -- 2.7.4