From e1042a6373773830297dfd5718938c12f21ae624 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 7 Feb 2026 15:31:53 +0900 Subject: fix: codegen of switch fallthrough --- tests/switch.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/switch.sh') diff --git a/tests/switch.sh b/tests/switch.sh index e77e250..7d9f894 100644 --- a/tests/switch.sh +++ b/tests/switch.sh @@ -210,3 +210,25 @@ int main() { return 0; } EOF + +test_exit_code 0 <<'EOF' +#include + +int f(int x) { + switch (x) { + case 1: + case 2: + return 12; + case 3: + case 4: + return 34; + } +} + +int main() { + ASSERT_EQ(12, f(1)); + ASSERT_EQ(12, f(2)); + ASSERT_EQ(34, f(3)); + ASSERT_EQ(34, f(4)); +} +EOF -- cgit v1.3-1-g0d28