aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-07 15:31:53 +0900
committernsfisis <nsfisis@gmail.com>2026-02-07 15:31:53 +0900
commite1042a6373773830297dfd5718938c12f21ae624 (patch)
treeae7f55dbe65a6b6d8e6cf075c82156523b8189f6 /tests
parentb90f2dcae69c04c50c56498e3c02a44d0d9da167 (diff)
downloadducc-e1042a6373773830297dfd5718938c12f21ae624.tar.gz
ducc-e1042a6373773830297dfd5718938c12f21ae624.tar.zst
ducc-e1042a6373773830297dfd5718938c12f21ae624.zip
fix: codegen of switch fallthrough
Diffstat (limited to 'tests')
-rw-r--r--tests/switch.sh22
1 files changed, 22 insertions, 0 deletions
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 <helpers.h>
+
+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