clang-format: [JS] Improve formatting of function literals in chains
Before:
getSomeLongPromise(.....)
.then(
function(value) {
body();
body();
})
.thenCatch(function(error) {
body();
body();
});
After:
getSomeLongPromise(.....)
.then(function(value) {
body();
body();
})
.thenCatch(function(error) {
body();
body();
});
llvm-svn: 218595
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 52f45c7..09d5f1f 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -249,6 +249,19 @@
" doFoo();\n"
" doBaz();\n"
" });\n");
+
+ verifyFormat("getSomeLongPromise()\n"
+ " .then(function(value) { body(); })\n"
+ " .thenCatch(function(error) { body(); });");
+ verifyFormat("getSomeLongPromise()\n"
+ " .then(function(value) {\n"
+ " body();\n"
+ " body();\n"
+ " })\n"
+ " .thenCatch(function(error) {\n"
+ " body();\n"
+ " body();\n"
+ " });");
}
TEST_F(FormatTestJS, ReturnStatements) {