Formatter: Detect ObjC array literals.
Use this to add a space after "@[" and before "]" for now.
Later, I want to use this to format multi-line array literals nicer, too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174822 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 8d72df2..4e44f5e 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -2540,8 +2540,13 @@
verifyFormat("NSNumber *favoriteColor = @(Green);");
verifyFormat("NSString *path = @(getenv(\"PATH\"));");
- // FIXME: Array and dictionary literals need more work.
verifyFormat("@[");
+ verifyFormat("@[]");
+ verifyFormat(
+ "NSArray *array = @[ @\" Hey \", NSApp, [NSNumber numberWithInt:42] ];");
+ verifyFormat("return @[ @3, @[], @[ @4, @5 ] ];");
+
+ // FIXME: Array and dictionary literals need more work.
verifyFormat("@{");
}