summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2018-08-03 09:34:41 +0000
committerMartin Probst <martin@probst.io>2018-08-03 09:34:41 +0000
commitec45bc2feaa43dffc5e2aa01825dee422487aac3 (patch)
tree2ac1452809d35d8cc464510e124a37869a0ac618 /clang/unittests/Format/FormatTestJS.cpp
parente60866a4e057e29004c3978e6f312c506a30b940 (diff)
downloadbcm5719-llvm-ec45bc2feaa43dffc5e2aa01825dee422487aac3.tar.gz
bcm5719-llvm-ec45bc2feaa43dffc5e2aa01825dee422487aac3.zip
clang-format: [JS] don't break comments before any '{'
Summary: Previously, clang-format would avoid breaking before the first `{` found, but then happily break before subsequent '{'s on the line. This change fixes that by looking for the first location that has no opening curly, if any. Reviewers: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50230 llvm-svn: 338837
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index fe148393b98..58a900352a2 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -2067,6 +2067,14 @@ TEST_F(FormatTestJS, JSDocAnnotations) {
" * @param {canWrap onSpace}\n"
" */",
getGoogleJSStyleWithColumns(20));
+ // make sure clang-format doesn't break before *any* '{'
+ verifyFormat("/**\n"
+ " * @lala {lala {lalala\n"
+ " */\n",
+ "/**\n"
+ " * @lala {lala {lalala\n"
+ " */\n",
+ getGoogleJSStyleWithColumns(20));
verifyFormat("/**\n"
" * @see http://very/very/long/url/is/long\n"
" */",
OpenPOWER on IntegriCloud