aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-10-22 15:30:28 +0000
committerDaniel Jasper <djasper@google.com>2013-10-22 15:30:28 +0000
commita07aa665a12ab23bef7aa4aedfe113dd8b13da57 (patch)
treec432b4d1a755421dfc2e2ead4687ba3881e671d9 /unittests
parenta2770ab2cfee53805ff603681317c425389356c2 (diff)
downloadclang-a07aa665a12ab23bef7aa4aedfe113dd8b13da57.tar.gz
clang-format: Improve formatting of ObjC array literals.
Before: NSArray *arguments = @[ kind == kUserTicket ? @"--user-store" : @"--system-store", @"--print-tickets", @"--productid", @"com.google.Chrome" ]; After: NSArray *arguments = @[ kind == kUserTicket ? @"--user-store" : @"--system-store", @"--print-tickets", @"--productid", @"com.google.Chrome" ]; This fixes llvm.org/PR15231. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 20132f9ccc..6dd9413392 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -5378,6 +5378,7 @@ TEST_F(FormatTest, ObjCLiterals) {
verifyFormat(
"NSArray *array = @[ @\" Hey \", NSApp, [NSNumber numberWithInt:42] ];");
verifyFormat("return @[ @3, @[], @[ @4, @5 ] ];");
+ verifyFormat("NSArray *array = @[ [foo description] ];");
verifyFormat("@{");
verifyFormat("@{}");
@@ -5408,6 +5409,13 @@ TEST_F(FormatTest, ObjCLiterals) {
" NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee : "
"regularFont,\n"
"};");
+ verifyFormat(
+ "NSArray *arguments = @[\n"
+ " kind == kUserTicket ? @\"--user-store\" : @\"--system-store\",\n"
+ " @\"--print-tickets\",\n"
+ " @\"--productid\",\n"
+ " @\"com.google.Chrome\"\n"
+ "];");
}
TEST_F(FormatTest, ReformatRegionAdjustsIndent) {