summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2018-01-26 15:07:49 +0000
committerMartin Probst <martin@probst.io>2018-01-26 15:07:49 +0000
commitf8e1f5c7d38d0298d7b078838b22ef24ec98aa45 (patch)
tree058a21dee85877c58ead61b59712e861a2674eaa /clang/unittests/Format/FormatTestJS.cpp
parent65ec923805d94cc503b9ca185d619928a3adb133 (diff)
downloadbcm5719-llvm-f8e1f5c7d38d0298d7b078838b22ef24ec98aa45.tar.gz
bcm5719-llvm-f8e1f5c7d38d0298d7b078838b22ef24ec98aa45.zip
clang-format: [JS] Prevent ASI before [ and (.
Summary: JavaScript automatic semicolon insertion can trigger before [ and (, so avoid breaking before them if the previous token is likely to terminate an expression. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D42570 llvm-svn: 323532
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 2a929563f75..47886521008 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -1157,6 +1157,9 @@ TEST_F(FormatTestJS, WrapRespectsAutomaticSemicolonInsertion) {
"foo() {}",
getGoogleJSStyleWithColumns(10));
verifyFormat("await theReckoning;", getGoogleJSStyleWithColumns(10));
+ verifyFormat("some['a']['b']", getGoogleJSStyleWithColumns(10));
+ verifyFormat("x = (a['a']\n"
+ " ['b']);", getGoogleJSStyleWithColumns(10));
}
TEST_F(FormatTestJS, AutomaticSemicolonInsertionHeuristic) {
OpenPOWER on IntegriCloud