summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-03-01 04:19:47 +0000
committerDaniel Jasper <djasper@google.com>2016-03-01 04:19:47 +0000
commitb18425bf96b1b8d4b21cf1827bda5fde6a91df3a (patch)
tree6299e9452c1817e5b2c2081aee7b6273a45b7f71 /clang/unittests/Format/FormatTestJS.cpp
parentd7511c8a2201af8d41b6107c8aa4e25b9b2e2f64 (diff)
downloadbcm5719-llvm-b18425bf96b1b8d4b21cf1827bda5fde6a91df3a.tar.gz
bcm5719-llvm-b18425bf96b1b8d4b21cf1827bda5fde6a91df3a.zip
clang-format: [JS] Support quoted object literal keys.
Before: var x = { a: a, b: b, 'c': c, }; After: var x = { a: a, b: b, 'c': c, }; llvm-svn: 262291
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 255f11e0ef3..39e4ea8566b 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -205,6 +205,13 @@ TEST_F(FormatTestJS, ContainerLiterals) {
verifyFormat("f({a}, () => {\n"
" g(); //\n"
"});");
+
+ // Keys can be quoted.
+ verifyFormat("var x = {\n"
+ " a: a,\n"
+ " b: b,\n"
+ " 'c': c,\n"
+ "};");
}
TEST_F(FormatTestJS, MethodsInObjectLiterals) {
OpenPOWER on IntegriCloud