summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 61acce3a977..4038e512590 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -240,6 +240,18 @@ TEST_F(FormatTestJS, ContainerLiterals) {
"};");
verifyFormat("var x = {y: (a) => a};");
+ // Methods in object literals.
+ verifyFormat("var x = {\n"
+ " y(a: string): number {\n"
+ " return a;\n"
+ " }\n"
+ "};");
+ verifyFormat("var x = {\n"
+ " y(a: string) {\n"
+ " return a;\n"
+ " }\n"
+ "};");
+
// Computed keys.
verifyFormat("var x = {[a]: 1, b: 2, [c]: 3};");
verifyFormat("var x = {\n"
OpenPOWER on IntegriCloud