diff options
Diffstat (limited to 'unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | unittests/Format/FormatTestJS.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index ecf4e69999..ddd594bb6e 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -146,6 +146,39 @@ TEST_F(FormatTestJS, Closures) { getGoogleJSStyleWithColumns(37)); } +TEST_F(FormatTestJS, MultipleFunctionLiterals) { + verifyFormat("promise.then(\n" + " function success() {\n" + " doFoo();\n" + " doBar();\n" + " },\n" + " function error() {\n" + " doFoo();\n" + " doBaz();\n" + " },\n" + " []);\n"); + verifyFormat("promise.then(\n" + " function success() {\n" + " doFoo();\n" + " doBar();\n" + " },\n" + " [],\n" + " function error() {\n" + " doFoo();\n" + " doBaz();\n" + " });\n"); + // FIXME: Here, we should probably break right after the "(" for consistency. + verifyFormat("promise.then([],\n" + " function success() {\n" + " doFoo();\n" + " doBar();\n" + " },\n" + " function error() {\n" + " doFoo();\n" + " doBaz();\n" + " });\n"); +} + TEST_F(FormatTestJS, ReturnStatements) { verifyFormat("function() { return [hello, world]; }"); } |