diff options
author | Krasimir Georgiev <krasimir@google.com> | 2021-08-24 12:36:53 +0200 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2021-08-24 12:37:08 +0200 |
commit | befb9dc3694e95355f21650de7acb058ac89f993 (patch) | |
tree | b2e448531f90a2915781d3e9cbe7070dac48b4b4 /clang/unittests/Format/FormatTestJS.cpp | |
parent | 2e8534beb2890d258efc711ef7520c8bff54befd (diff) | |
download | llvm-befb9dc3694e95355f21650de7acb058ac89f993.zip llvm-befb9dc3694e95355f21650de7acb058ac89f993.tar.gz llvm-befb9dc3694e95355f21650de7acb058ac89f993.tar.bz2 |
[clang-format] keep TypeScript argument decorators in line
As a follow-up from https://reviews.llvm.org/D108538, ensure TypeScript
argument decorators are kept in line with the argument.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D108620
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 8da822d..311881d 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -701,8 +701,12 @@ TEST_F(FormatTestJS, FormatsFreestandingFunctions) { getGoogleJSStyleWithColumns(20))); } -TEST_F(FormatTestJS, FormatsDecoratedFunctions) { - // Regression test: ensure that there is a break before `get`. +TEST_F(FormatTestJS, FormatsDecorators) { + // No line break after argument decorators. + verifyFormat("class A {\n" + " constructor(@arg(DECOR) private arg: Type) {}\n" + "}"); + // Ensure that there is a break before functions, getters and setters. EXPECT_EQ("class A {\n" " private p = () => {}\n" "\n" @@ -710,6 +714,24 @@ TEST_F(FormatTestJS, FormatsDecoratedFunctions) { " get f() {\n" " return result;\n" " }\n" + "}\n" + "\n" + "class B {\n" + " private p = () => {}\n" + "\n" + " @decorated('a')\n" + " set f() {\n" + " return result;\n" + " }\n" + "}\n" + "\n" + "class C {\n" + " private p = () => {}\n" + "\n" + " @decorated('a')\n" + " function f() {\n" + " return result;\n" + " }\n" "}", format("class A {\n" " private p = () => {}\n" @@ -718,6 +740,24 @@ TEST_F(FormatTestJS, FormatsDecoratedFunctions) { " get f() {\n" " return result;\n" " }\n" + "}\n" + "\n" + "class B {\n" + " private p = () => {}\n" + "\n" + " @decorated('a')\n" + " set f() {\n" + " return result;\n" + " }\n" + "}\n" + "\n" + "class C {\n" + " private p = () => {}\n" + "\n" + " @decorated('a')\n" + " function f() {\n" + " return result;\n" + " }\n" "}", getGoogleJSStyleWithColumns(50))); } |