diff options
author | Daniel Jasper <djasper@google.com> | 2015-12-22 15:48:15 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-12-22 15:48:15 +0000 |
commit | e2deb59fa3e1e13991b0fe370781d92913767717 (patch) | |
tree | 5406476a28dda1ee4f68a0463ee991aa04a68331 /clang/unittests/Format/FormatTestJS.cpp | |
parent | 72a1b6a5f245509e45fa9e01e1fbc4a917c51fd4 (diff) | |
download | bcm5719-llvm-e2deb59fa3e1e13991b0fe370781d92913767717.tar.gz bcm5719-llvm-e2deb59fa3e1e13991b0fe370781d92913767717.zip |
clang-format: [JS] Conservatively introduce column layout for JS array
initializers. For now, only use it for 20 items or more. Otherwise,
clang-format formats these one-per-line and thus increases the vertical
code size a lot.
llvm-svn: 256246
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 0957759397f..93a4eba4a93 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -314,6 +314,17 @@ TEST_F(FormatTestJS, ArrayLiterals) { verifyFormat("someFunction([], {a: a});"); } +TEST_F(FormatTestJS, ColumnLayoutForArrayLiterals) { + verifyFormat("var array = [\n" + " a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,\n" + " a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,\n" + "];"); + verifyFormat("var array = someFunction([\n" + " a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,\n" + " a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,\n" + "]);"); +} + TEST_F(FormatTestJS, FunctionLiterals) { verifyFormat("doFoo(function() {});"); verifyFormat("doFoo(function() { return 1; });"); |