summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-06-18 12:32:59 +0000
committerDaniel Jasper <djasper@google.com>2015-06-18 12:32:59 +0000
commited3f395773957d204b7653624a10312e0d6a22dd (patch)
treefc88d74d6d3fb0434eab33f8d18990e60d7b4a21 /clang/unittests/Format/FormatTestJS.cpp
parent17394218931bd6fc53cade6a3d4884579da077b6 (diff)
downloadbcm5719-llvm-ed3f395773957d204b7653624a10312e0d6a22dd.tar.gz
bcm5719-llvm-ed3f395773957d204b7653624a10312e0d6a22dd.zip
clang-format: [JS] Add a special case for indenting function literals.
Before: var func = function() { doSomething(); }; After: var func = function() { doSomething(); }; This is a very narrow special case which fixes most of the discrepency with what our users do. In the long run, we should try to come up with a more generic fix for indenting these. llvm-svn: 240014
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 6479805b16f..15d62eb66c3 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -294,6 +294,10 @@ TEST_F(FormatTestJS, FunctionLiterals) {
verifyFormat("var func = function() {\n"
" return 1;\n"
"};");
+ verifyFormat("var func = //\n"
+ " function() {\n"
+ " return 1;\n"
+ "};");
verifyFormat("return {\n"
" body: {\n"
" setAttribute: function(key, val) { this[key] = val; },\n"
OpenPOWER on IntegriCloud