summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-06-03 08:43:18 +0000
committerDaniel Jasper <djasper@google.com>2015-06-03 08:43:18 +0000
commit81dbb564a14ff7a162ae920456f064e865294ed0 (patch)
tree82fab7a770e1e02649dda466ceb8f8fc1cffc65d /clang/unittests/Format/FormatTestJS.cpp
parent452252e6c879a42b074280bc156865d1d0c7cee9 (diff)
downloadbcm5719-llvm-81dbb564a14ff7a162ae920456f064e865294ed0.tar.gz
bcm5719-llvm-81dbb564a14ff7a162ae920456f064e865294ed0.zip
clang-format: [JS] Fix bug in type colon detection.
Before, this couldn't be formatted at all: class X { subs = { 'b': { 'c': 1, }, }; } llvm-svn: 238907
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 80a3e0a66a0..3ed3cdeee1a 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -631,6 +631,15 @@ TEST_F(FormatTestJS, ClassDeclarations) {
verifyFormat("class C {\n static x(): string { return 'asd'; }\n}");
verifyFormat("class C extends P implements I {}");
verifyFormat("class C extends p.P implements i.I {}");
+
+ // ':' is not a type declaration here.
+ verifyFormat("class X {\n"
+ " subs = {\n"
+ " 'b': {\n"
+ " 'c': 1,\n"
+ " },\n"
+ " };\n"
+ "}");
}
TEST_F(FormatTestJS, InterfaceDeclarations) {
OpenPOWER on IntegriCloud