summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-05-29 06:19:49 +0000
committerDaniel Jasper <djasper@google.com>2015-05-29 06:19:49 +0000
commit8c42d445e35bcb5a6ea39972757f298b9cf2f7e2 (patch)
tree5dabc09e95ff54c18860ceb809f87a1f1ae51824 /clang/unittests/Format/FormatTestJS.cpp
parent2af5e6fbf921401f6dc5d71a44cbc1b609c1d30c (diff)
downloadbcm5719-llvm-8c42d445e35bcb5a6ea39972757f298b9cf2f7e2.tar.gz
bcm5719-llvm-8c42d445e35bcb5a6ea39972757f298b9cf2f7e2.zip
clang-format: [JS] Support ES6 computed property names.
Before: var x = { [a]: 1, b: 2 }; After: var x = { [a]: 1, b: 2 }; llvm-svn: 238544
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index a536926c73c..d95ff9ba834 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -151,6 +151,11 @@ TEST_F(FormatTestJS, ContainerLiterals) {
// Arrow functions in object literals.
verifyFormat("var x = {y: (a) => { return a; }};");
verifyFormat("var x = {y: (a) => a};");
+
+ // Computed keys.
+ verifyFormat("var x = {\n"
+ " [a]: 1,\n"
+ "};");
}
TEST_F(FormatTestJS, MethodsInObjectLiterals) {
OpenPOWER on IntegriCloud