summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestObjC.cpp
diff options
context:
space:
mode:
authorBen Hamilton <benhamilton@google.com>2018-04-03 14:07:09 +0000
committerBen Hamilton <benhamilton@google.com>2018-04-03 14:07:09 +0000
commit1915d2ac4f8d5b5bcfb716f7b03fb30d3228de82 (patch)
tree4b3285d97459c1d0747d61e45c11c3459bd8ce33 /clang/unittests/Format/FormatTestObjC.cpp
parent823e5f90db76287fef9b0b53e3391aade3c79146 (diff)
downloadbcm5719-llvm-1915d2ac4f8d5b5bcfb716f7b03fb30d3228de82.tar.gz
bcm5719-llvm-1915d2ac4f8d5b5bcfb716f7b03fb30d3228de82.zip
[clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal
Summary: D44816 attempted to fix a few cases where `clang-format` incorrectly inserted a space before the closing brace of an Objective-C dictionary literal. This revealed there were still a few cases where we inserted a space after the opening brace of an Objective-C dictionary literal. This fixes the formatting to be consistent and adds more tests. Test Plan: New tests added. Confirmed tests failed before diff and passed after diff. Ran tests with: % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, jolesiak, krasimir Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45168 llvm-svn: 329069
Diffstat (limited to 'clang/unittests/Format/FormatTestObjC.cpp')
-rw-r--r--clang/unittests/Format/FormatTestObjC.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestObjC.cpp b/clang/unittests/Format/FormatTestObjC.cpp
index 5c12911be12..ed5d1aa2560 100644
--- a/clang/unittests/Format/FormatTestObjC.cpp
+++ b/clang/unittests/Format/FormatTestObjC.cpp
@@ -1021,8 +1021,17 @@ TEST_F(FormatTestObjC, ObjCDictLiterals) {
" a12345 = @{a12345 : a12345};\n"
"}");
verifyFormat("int Foo() {\n"
+ " a12345 = @{a12345 : @(a12345)};\n"
+ "}");
+ verifyFormat("int Foo() {\n"
" a12345 = @{(Foo *)a12345 : @(a12345)};\n"
"}");
+ verifyFormat("int Foo() {\n"
+ " a12345 = @{@(a12345) : a12345};\n"
+ "}");
+ verifyFormat("int Foo() {\n"
+ " a12345 = @{@(a12345) : @YES};\n"
+ "}");
Style.SpacesInContainerLiterals = false;
verifyFormat("int Foo() {\n"
" b12345 = @{b12345: b12345};\n"
OpenPOWER on IntegriCloud