summaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Format/FormatTestJS.cpp')
-rw-r--r--unittests/Format/FormatTestJS.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp
index 7886c4fe27ad8..eda9e0a31da46 100644
--- a/unittests/Format/FormatTestJS.cpp
+++ b/unittests/Format/FormatTestJS.cpp
@@ -485,6 +485,20 @@ TEST_F(FormatTestJS, AsyncFunctions) {
" let x = 1;\n"
" return fetch(x);\n"
"}");
+ verifyFormat("async function f() {\n"
+ " return 1;\n"
+ "}\n"
+ "\n"
+ "function a() {\n"
+ " return 1;\n"
+ "}\n",
+ " async function f() {\n"
+ " return 1;\n"
+ "}\n"
+ "\n"
+ " function a() {\n"
+ " return 1;\n"
+ "} \n");
verifyFormat("async function* f() {\n"
" yield fetch(x);\n"
"}");
@@ -492,6 +506,9 @@ TEST_F(FormatTestJS, AsyncFunctions) {
" return fetch(x);\n"
"}");
verifyFormat("let x = async () => f();");
+ verifyFormat("let x = async function() {\n"
+ " f();\n"
+ "};");
verifyFormat("let x = async();");
verifyFormat("class X {\n"
" async asyncMethod() {\n"