diff options
author | Daniel Jasper <djasper@google.com> | 2014-06-13 07:02:04 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-06-13 07:02:04 +0000 |
commit | 71bd6fc3cc738663bfa8888cec4be678a8a75dc6 (patch) | |
tree | 2a1a5430524501232e4bc2dc077ed1a9f5511c87 /unittests | |
parent | 22b4e77bd6ac8b36a61fb1cf830c3af191950d4c (diff) | |
download | clang-71bd6fc3cc738663bfa8888cec4be678a8a75dc6.tar.gz |
clang-format: [JS] Understand named function literals.
Before:
return {a: function SomeFunction(){// ...
return 1;
}
}
;
After:
return {
a: function SomeFunction() {
// ...
return 1;
}
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTestJS.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index 485ccd624e..7f5507ee26 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -138,7 +138,7 @@ TEST_F(FormatTestJS, GoogScopes) { "}); // goog.scope"); } -TEST_F(FormatTestJS, Closures) { +TEST_F(FormatTestJS, FunctionLiterals) { verifyFormat("doFoo(function() { return 1; });"); verifyFormat("var func = function() { return 1; };"); verifyFormat("return {\n" @@ -177,6 +177,13 @@ TEST_F(FormatTestJS, Closures) { " a: function() { return 1; }\n" "};", getGoogleJSStyleWithColumns(37)); + + verifyFormat("return {\n" + " a: function SomeFunction() {\n" + " // ...\n" + " return 1;\n" + " }\n" + "};"); } TEST_F(FormatTestJS, MultipleFunctionLiterals) { |