summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-04-04 07:56:55 +0000
committerDaniel Jasper <djasper@google.com>2015-04-04 07:56:55 +0000
commit739ec534d2e2f99fbc541b5f126184bfa3c1dde6 (patch)
tree284ae0201c2e82b73e197aee22de6a74166055d3 /clang/unittests/Format/FormatTestJS.cpp
parentf205f5324bca303a997d383d3a9b7014f79fdfdc (diff)
downloadbcm5719-llvm-739ec534d2e2f99fbc541b5f126184bfa3c1dde6.tar.gz
bcm5719-llvm-739ec534d2e2f99fbc541b5f126184bfa3c1dde6.zip
clang-format: [JS] Understand object literals with only methods.
Before: let theObject = {someMethodName() { doTheThing(); doTheOtherThing(); }, someOtherMethodName() { doSomething(); doSomethingElse(); }}; After: let theObject = { someMethodName() { doTheThing(); doTheOtherThing(); }, someOtherMethodName() { doSomething(); doSomethingElse(); } }; llvm-svn: 234091
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 00744728ddb..35727eb686b 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -163,6 +163,14 @@ TEST_F(FormatTestJS, MethodsInObjectLiterals) {
" doSomething(this.value + val);\n"
" }\n"
"};");
+ verifyFormat("var o = {\n"
+ " someMethod(val) { // method\n"
+ " doSomething(this.value + val);\n"
+ " },\n"
+ " someOtherMethod(val) { // method\n"
+ " doSomething(this.value + val);\n"
+ " }\n"
+ "};");
}
TEST_F(FormatTestJS, SpacesInContainerLiterals) {
OpenPOWER on IntegriCloud