aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-11-20 14:22:43 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-11-20 14:22:43 +0000
commitc1631019a8cb0845d2f939613329d6210c7d4a2f (patch)
tree09a71cccbf4e3ef03da2b95741a256a83b4deab4 /clang/unittests
parentf5e4f0af7b450562af46a5df5e071bc79d021c16 (diff)
[clang-format] JS: don't treat is: as a type matcher
Summary: Clang-format is treating all occurences of `is` in js as type matchers. In some cases this is wrong, as it might be a dict key. Reviewers: mprobst Reviewed By: mprobst Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D54753 llvm-svn: 347307
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 5a71f003371b..a14724f85ebe 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -1186,6 +1186,16 @@ TEST_F(FormatTestJS, WrapRespectsAutomaticSemicolonInsertion) {
getGoogleJSStyleWithColumns(25));
}
+TEST_F(FormatTestJS, AddsIsTheDictKeyOnNewline) {
+ // Do not confuse is, the dict key with is, the type matcher. Put is, the dict
+ // key, on a newline.
+ verifyFormat("Polymer({\n"
+ " is: '', //\n"
+ " rest: 1\n"
+ "});",
+ getGoogleJSStyleWithColumns(20));
+}
+
TEST_F(FormatTestJS, AutomaticSemicolonInsertionHeuristic) {
verifyFormat("a\n"
"b;",