From 0632b5db77ca5ecabbccd0edd5e569ee3895f739 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Wed, 30 Apr 2025 14:13:58 -0400 Subject: [PATCH] Regression tests for try/catch --- src/tests/keywords/try-no-sibiling | 29 +++++++++++++++++++ .../keywords/try-norcode-catch-no-sibling | 23 +++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/tests/keywords/try-no-sibiling create mode 100644 src/tests/keywords/try-norcode-catch-no-sibling diff --git a/src/tests/keywords/try-no-sibiling b/src/tests/keywords/try-no-sibiling new file mode 100644 index 0000000000..2cb6da5855 --- /dev/null +++ b/src/tests/keywords/try-no-sibiling @@ -0,0 +1,29 @@ +# +# PRE: if +# +string foo +string bar + +group { + try { + foo := "hello" + + fail + + bar := "nope" + } + catch disallow { + test_fail + } + catch ok reject fail { + if foo != "hello" { + test_fail + } + + if bar { + test_fail + } + } +} + +success diff --git a/src/tests/keywords/try-norcode-catch-no-sibling b/src/tests/keywords/try-norcode-catch-no-sibling new file mode 100644 index 0000000000..f4815b4972 --- /dev/null +++ b/src/tests/keywords/try-norcode-catch-no-sibling @@ -0,0 +1,23 @@ +# +# PRE: if +# +string foo + +# +# Try returns noop - which is not caught +# +# Regression test where there are no more sibilings for catch. +# +group { + try { + foo := "hello" + } + catch disallow { + test_fail + } + catch ok reject fail { + test_fail + } +} + +success -- 2.47.2