diff options
| author | Daniel Jasper <djasper@google.com> | 2014-04-14 12:05:05 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-04-14 12:05:05 +0000 |
| commit | af4fee2636b304ed86e8d05d8f076219d595b54c (patch) | |
| tree | 195ca2bc9794fc9a4d766aaea3971f1a1ee63138 /clang/unittests/Format/FormatTest.cpp | |
| parent | 90527cb3249f353ac0f67d923c484ee949e3c939 (diff) | |
| download | bcm5719-llvm-af4fee2636b304ed86e8d05d8f076219d595b54c.tar.gz bcm5719-llvm-af4fee2636b304ed86e8d05d8f076219d595b54c.zip | |
clang-format: With ColumnLimit=0, keep short array literals on a line.
Before:
NSArray* a = [[NSArray alloc] initWithArray:@[
@"a"
]
copyItems:YES];
After:
NSArray* a = [[NSArray alloc] initWithArray:@[ @"a" ]
copyItems:YES];
This fixed llvm.org/PR19080.
llvm-svn: 206161
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 0dc06594f15..7bae21b89e6 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -8148,6 +8148,20 @@ TEST_F(FormatTest, FormatsWithWebKitStyle) { format("#define aNumber \\\n" " 10", Style)); + + // Keep empty and one-element array literals on a single line. + verifyFormat("NSArray* a = [[NSArray alloc] initWithArray:@[]\n" + " copyItems:YES];", + Style); + verifyFormat("NSArray* a = [[NSArray alloc] initWithArray:@[ @\"a\" ]\n" + " copyItems:YES];", + Style); + verifyFormat("NSArray* a = [[NSArray alloc] initWithArray:@[\n" + " @\"a\",\n" + " @\"a\"\n" + " ]\n" + " copyItems:YES];", + Style); } TEST_F(FormatTest, FormatsLambdas) { |

