clang-format: [JS] tests for async wrapping.
Summary: Adds tests to ensure that `async method() ...` does not wrap between async and the method name, which would cause automatic semicolon insertion. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70377
This commit is contained in:
parent
23c113802e
commit
736a380212
|
@ -737,6 +737,22 @@ TEST_F(FormatTestJS, AsyncFunctions) {
|
|||
" function a() {\n"
|
||||
" return 1;\n"
|
||||
"} \n");
|
||||
// clang-format must not insert breaks between async and function, otherwise
|
||||
// automatic semicolon insertion may trigger (in particular in a class body).
|
||||
verifyFormat("async function\n"
|
||||
"hello(\n"
|
||||
" myparamnameiswaytooloooong) {\n"
|
||||
"}",
|
||||
"async function hello(myparamnameiswaytooloooong) {}",
|
||||
getGoogleJSStyleWithColumns(10));
|
||||
verifyFormat("class C {\n"
|
||||
" async hello(\n"
|
||||
" myparamnameiswaytooloooong) {\n"
|
||||
" }\n"
|
||||
"}",
|
||||
"class C {\n"
|
||||
" async hello(myparamnameiswaytooloooong) {} }",
|
||||
getGoogleJSStyleWithColumns(10));
|
||||
verifyFormat("async function* f() {\n"
|
||||
" yield fetch(x);\n"
|
||||
"}");
|
||||
|
|
Loading…
Reference in New Issue