clang-format: [JS] Understand named function literals.
Before:
return {a: function SomeFunction(){// ...
return 1;
}
}
;
After:
return {
a: function SomeFunction() {
// ...
return 1;
}
};
llvm-svn: 210887
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 485ccd6..7f5507e 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -138,7 +138,7 @@
"}); // goog.scope");
}
-TEST_F(FormatTestJS, Closures) {
+TEST_F(FormatTestJS, FunctionLiterals) {
verifyFormat("doFoo(function() { return 1; });");
verifyFormat("var func = function() { return 1; };");
verifyFormat("return {\n"
@@ -177,6 +177,13 @@
" a: function() { return 1; }\n"
"};",
getGoogleJSStyleWithColumns(37));
+
+ verifyFormat("return {\n"
+ " a: function SomeFunction() {\n"
+ " // ...\n"
+ " return 1;\n"
+ " }\n"
+ "};");
}
TEST_F(FormatTestJS, MultipleFunctionLiterals) {