diff options
author | Martin Probst <martin@probst.io> | 2017-11-24 10:48:25 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2017-11-24 10:48:25 +0000 |
commit | 6b3cbe94dcc5f1db2f0b6116c60caa5cadc9b539 (patch) | |
tree | f87fd121d0fa829aba563d62c52d34de57fba1ac /unittests | |
parent | be065bce297cc2dd2773caf4346c218d04492913 (diff) |
clang-format: [JS] handle destructuring `of`.
Summary:
Previously, clang-format would drop a space character between `of` and
then following (non-identifier) token if the preceding token was part of
a destructuring assignment (`}` or `]`).
Before:
for (const [a, b] of[]) {}
After:
for (const [a, b] of []) {}
Reviewers: djasper
Subscribers: klimek
Differential Revision: https://reviews.llvm.org/D40411
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318942 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTestJS.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index 3e5abdc098..d9176599fb 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -1110,6 +1110,10 @@ TEST_F(FormatTestJS, ForLoops) { "}"); verifyFormat("for (let {a, b} of x) {\n" "}"); + verifyFormat("for (let {a, b} of [x]) {\n" + "}"); + verifyFormat("for (let [a, b] of [x]) {\n" + "}"); verifyFormat("for (let {a, b} in x) {\n" "}"); } |