summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
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
commit1db6c3868760d6c9c05b238b636f155d3247ecc2 (patch)
tree7aa91a94966d112c911541ae60769fba4e581168 /clang/unittests/Format/FormatTest.cpp
parent69f531065ced9fcbe62750dc114326d4056b6639 (diff)
downloadbcm5719-llvm-1db6c3868760d6c9c05b238b636f155d3247ecc2.tar.gz
bcm5719-llvm-1db6c3868760d6c9c05b238b636f155d3247ecc2.zip
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. llvm-svn: 193167
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 20132f9cccc..6dd94133922 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud