From 1699eca119e3488a21dfe50cbbfe8f1508b23eb3 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 1 Jun 2015 09:56:32 +0000 Subject: clang-format: [JS] Making arrow function wrapping more consistent. Before: someFunction(() => { doSomething(); // break }) .doSomethingElse( // break ); After: someFunction(() => { doSomething(); // break }) .doSomethingElse( // break ); This is still bad, but at least it is consistent with what we do for other function literals. Added corresponding tests. llvm-svn: 238736 --- clang/unittests/Format/FormatTestJS.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'clang/unittests/Format/FormatTestJS.cpp') diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 29b8aa1ff13..20c10b634bf 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -337,6 +337,14 @@ TEST_F(FormatTestJS, FunctionLiterals) { " doSomething();\n" " doSomething();\n" " }, this));"); + + // FIXME: This is bad, we should be wrapping before "function() {". + verifyFormat("someFunction(function() {\n" + " doSomething(); // break\n" + "})\n" + " .doSomethingElse(\n" + " // break\n" + " );"); } TEST_F(FormatTestJS, InliningFunctionLiterals) { @@ -455,7 +463,14 @@ TEST_F(FormatTestJS, ArrowFunctions) { " return a;\n" "};"); verifyFormat("var x = (a) => a;"); - verifyFormat("var x = (a) => a;"); + + // FIXME: This is bad, we should be wrapping before "() => {". + verifyFormat("someFunction(() => {\n" + " doSomething(); // break\n" + "})\n" + " .doSomethingElse(\n" + " // break\n" + " );"); } TEST_F(FormatTestJS, ReturnStatements) { -- cgit v1.2.3