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
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 255f11e..39e4ea8 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -205,6 +205,13 @@
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) {