summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-06-10 14:44:02 +0000
committerDaniel Jasper <djasper@google.com>2014-06-10 14:44:02 +0000
commit17062ff5509495c41645155247241749e0f19a33 (patch)
tree9d7ae0af807eb05430cc7529eccd35b4081cfd03 /clang/unittests/Format/FormatTestJS.cpp
parentf910a0650eb4aad5e50e997c9438d7eef60dc901 (diff)
downloadbcm5719-llvm-17062ff5509495c41645155247241749e0f19a33.tar.gz
bcm5719-llvm-17062ff5509495c41645155247241749e0f19a33.zip
clang-format: [JS] Treat dict literals similar to objc method exprs.
Before: return { link: function() { f(); // } }; return { a: a, link: function() { f(); // } } After: return { link: function() { f(); // } }; return { a: a, link: function() { f(); // } }; llvm-svn: 210537
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 50fef8d8646..485ccd624e6 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -88,6 +88,31 @@ TEST_F(FormatTestJS, ES6DestructuringAssignment) {
verifyFormat("var {a, b} = {a: 1, b: 2};");
}
+TEST_F(FormatTestJS, ContainerLiterals) {
+ verifyFormat("return {\n"
+ " link: function() {\n"
+ " f(); //\n"
+ " }\n"
+ "};");
+ verifyFormat("return {\n"
+ " a: a,\n"
+ " link: function() {\n"
+ " f(); //\n"
+ " }\n"
+ "};");
+ verifyFormat("return {\n"
+ " a: a,\n"
+ " link:\n"
+ " function() {\n"
+ " f(); //\n"
+ " },\n"
+ " link:\n"
+ " function() {\n"
+ " f(); //\n"
+ " }\n"
+ "};");
+}
+
TEST_F(FormatTestJS, SpacesInContainerLiterals) {
verifyFormat("var arr = [1, 2, 3];");
verifyFormat("var obj = {a: 1, b: 2, c: 3};");
OpenPOWER on IntegriCloud