aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2024-08-28 13:45:17 +0200
committerGitHub <noreply@github.com>2024-08-28 13:45:17 +0200
commit77d63cfd18aa6643544cf7acd5ee287689d54cca (patch)
treeae0a146c31807037eee8cb3eb8350a929a9d385d /clang/unittests/Format/FormatTestJS.cpp
parentf7a74ece5ad5553f9d06ce6edd3519483732ed04 (diff)
downloadllvm-77d63cfd18aa6643544cf7acd5ee287689d54cca.zip
llvm-77d63cfd18aa6643544cf7acd5ee287689d54cca.tar.gz
llvm-77d63cfd18aa6643544cf7acd5ee287689d54cca.tar.bz2
[clang-format] js handle anonymous classes (#106242)
Addresses a regression in JavaScript when formatting anonymous classes. --------- Co-authored-by: Owen Pan <owenpiano@gmail.com>
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index b910ce6..4b29ba7 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -579,6 +579,14 @@ TEST_F(FormatTestJS, GoogScopes) {
"});");
}
+TEST_F(FormatTestJS, GoogAnonymousClass) {
+ verifyFormat("a = class extends goog.structs.a {\n"
+ " a() {\n"
+ " return 0;\n"
+ " }\n"
+ "};");
+}
+
TEST_F(FormatTestJS, IIFEs) {
// Internal calling parens; no semi.
verifyFormat("(function() {\n"