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
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index a536926..d95ff9b 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -151,6 +151,11 @@
// 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) {