From e560c40a9ce3902e655f34078382a52d9b85be1b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 1 May 2026 22:32:36 +0300 Subject: add guard test --- tests/guard/guard.fwd | 21 +++++++++++++++++++++ tests/guard/test.mk | 1 + 2 files changed, 22 insertions(+) create mode 100644 tests/guard/guard.fwd create mode 100644 tests/guard/test.mk (limited to 'tests') diff --git a/tests/guard/guard.fwd b/tests/guard/guard.fwd new file mode 100644 index 0000000..dbde0f3 --- /dev/null +++ b/tests/guard/guard.fwd @@ -0,0 +1,21 @@ +import "../../mod/libfwdio.so" + +guard(bool cond, () err | () ok) +{ + if cond { + err(); + } else { + ok(); + } +} + +main() +{ + guard(1 > 2) => { + fwdprint_str("guard or comparison broken"); + fwdprint_nl(); + } => ; + + fwdprint_str("OK"); + fwdprint_nl(); +} diff --git a/tests/guard/test.mk b/tests/guard/test.mk new file mode 100644 index 0000000..3214e3c --- /dev/null +++ b/tests/guard/test.mk @@ -0,0 +1 @@ +XPASS += guard -- cgit v1.2.3