From: Arran Cudbard-Bell Date: Wed, 30 Apr 2025 18:13:58 +0000 (-0400) Subject: Regression tests for try/catch X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0632b5db77ca5ecabbccd0edd5e569ee3895f739;p=thirdparty%2Ffreeradius-server.git Regression tests for try/catch --- 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