clang-format: [JS] Support different function literal style.
Before:
goog.array.forEach(array, function() {
doSomething();
doSomething();
},
this);
After:
goog.array.forEach(array, function() {
doSomething();
doSomething();
}, this);
llvm-svn: 209291
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 657f108..257c247 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -120,6 +120,18 @@
"};");
EXPECT_EQ("abc = xyz ? function() { return 1; } : function() { return -1; };",
format("abc=xyz?function(){return 1;}:function(){return -1;};"));
+
+ verifyFormat("var closure = goog.bind(\n"
+ " function() { // comment\n"
+ " foo();\n"
+ " bar();\n"
+ " },\n"
+ " this, arg1IsReallyLongAndNeeedsLineBreaks,\n"
+ " arg3IsReallyLongAndNeeedsLineBreaks);");
+ verifyFormat("var closure = goog.bind(function() { // comment\n"
+ " foo();\n"
+ " bar();\n"
+ "}, this);");
}
TEST_F(FormatTestJS, ReturnStatements) {