aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2024-09-11 19:34:54 -0700
committerGitHub <noreply@github.com>2024-09-11 19:34:54 -0700
commit8168088f0a9015bc6d930e8bc1c639dee06ca82c (patch)
tree1482a91f2fc8e69a9ce8078da0868c513454051f /clang/unittests/Format/FormatTestJS.cpp
parent335538c271c9c71ef3f2e23680265e7b77595be0 (diff)
downloadllvm-8168088f0a9015bc6d930e8bc1c639dee06ca82c.zip
llvm-8168088f0a9015bc6d930e8bc1c639dee06ca82c.tar.gz
llvm-8168088f0a9015bc6d930e8bc1c639dee06ca82c.tar.bz2
[clang-format] Fix regressions in BAS_AlwaysBreak (#107506)
Fixes #107401. Fixes #107574.
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 4b29ba7..c25228a 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -2850,5 +2850,22 @@ TEST_F(FormatTestJS, DontBreakFieldsAsGoToLabels) {
"};");
}
+TEST_F(FormatTestJS, BreakAfterOpenBracket) {
+ auto Style = getGoogleStyle(FormatStyle::LK_JavaScript);
+ EXPECT_EQ(Style.AlignAfterOpenBracket, FormatStyle::BAS_AlwaysBreak);
+ verifyFormat("ctrl.onCopy(/** @type {!WizEvent}*/ (\n"
+ " {event, targetElement: {el: () => selectedElement}}));",
+ Style);
+ verifyFormat("failedUserIds.push(...subscriptioxxxxxxxxxxxxnSubset.map(\n"
+ " subscxxxxxxxxxxxxription => subscription.getUserId()));",
+ Style);
+ verifyFormat("failedUserIds.push(!subscriptioxxxxxxxxxxxxnSubset.map(\n"
+ " subscxxxxxxxxxxxxription => subscription.getUserId()));",
+ Style);
+ verifyFormat("failedUserIds.push(await subscriptioxxxxxxxxxxxxnSubset.map(\n"
+ " subscxxxxxxxxxxxxription => subscription.getUserId()));",
+ Style);
+}
+
} // namespace format
} // end namespace clang