aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestCSharp.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2024-10-21 18:50:13 -0700
committerGitHub <noreply@github.com>2024-10-21 18:50:13 -0700
commitb5bcdb5cfae452da30a699d7967cc1e0800ca997 (patch)
tree5706585838e33f2f9884a00bcb850b8443cb542d /clang/unittests/Format/FormatTestCSharp.cpp
parent2ce655cf1b029481b88b48b409d7423472856b38 (diff)
downloadllvm-b5bcdb5cfae452da30a699d7967cc1e0800ca997.zip
llvm-b5bcdb5cfae452da30a699d7967cc1e0800ca997.tar.gz
llvm-b5bcdb5cfae452da30a699d7967cc1e0800ca997.tar.bz2
[clang-format] Fix a crash on C# `goto case` (#113056)
Fixes #113011.
Diffstat (limited to 'clang/unittests/Format/FormatTestCSharp.cpp')
-rw-r--r--clang/unittests/Format/FormatTestCSharp.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestCSharp.cpp b/clang/unittests/Format/FormatTestCSharp.cpp
index 3b04238..0c5afa1 100644
--- a/clang/unittests/Format/FormatTestCSharp.cpp
+++ b/clang/unittests/Format/FormatTestCSharp.cpp
@@ -1688,6 +1688,18 @@ TEST_F(FormatTestCSharp, BrokenBrackets) {
EXPECT_NE("", format("int where b <")); // reduced from crasher
}
+TEST_F(FormatTestCSharp, GotoCaseLabel) {
+ verifyNoCrash("switch (i) {\n"
+ "case 0:\n"
+ " goto case 1;\n"
+ "case 1:\n"
+ " j = 0;\n"
+ " {\n"
+ " break;\n"
+ " }\n"
+ "}");
+}
+
} // namespace
} // namespace test
} // namespace format