aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 4e44f5e650..6d434ca464 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -2546,9 +2546,21 @@ TEST_F(FormatTest, ObjCLiterals) {
"NSArray *array = @[ @\" Hey \", NSApp, [NSNumber numberWithInt:42] ];");
verifyFormat("return @[ @3, @[], @[ @4, @5 ] ];");
- // FIXME: Array and dictionary literals need more work.
verifyFormat("@{");
-
+ verifyFormat("@{}");
+ verifyFormat("@{ @\"one\" : @1 }");
+ verifyFormat("return @{ @\"one\" : @1 };");
+ verifyFormat("@{ @\"one\" : @1, }");
+ verifyFormat("@{ @\"one\" : @{ @2 : @1 } }");
+ verifyFormat("@{ @\"one\" : @{ @2 : @1 }, }");
+ verifyFormat("@{ 1 > 2 ? @\"one\" : @\"two\" : 1 > 2 ? @1 : @2 }");
+ verifyFormat("[self setDict:@{}");
+ verifyFormat("[self setDict:@{ @1 : @2 }");
+ verifyFormat("NSLog(@\"%@\", @{ @1 : @2, @2 : @3 }[@1]);");
+ verifyFormat(
+ "NSDictionary *masses = @{ @\"H\" : @1.0078, @\"He\" : @4.0026 };");
+
+ // FIXME: Nested and multi-line array and dictionary literals need more work.
}
TEST_F(FormatTest, ReformatRegionAdjustsIndent) {