aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2026-05-01 22:32:36 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2026-05-01 22:32:36 +0300
commite560c40a9ce3902e655f34078382a52d9b85be1b (patch)
tree8c8ead79a743c07940db095854a9edc447307e7e
parent44fb150915fee559658d2296a5ba987925d27f78 (diff)
downloadfwd-e560c40a9ce3902e655f34078382a52d9b85be1b.tar.gz
fwd-e560c40a9ce3902e655f34078382a52d9b85be1b.zip
add guard test
-rw-r--r--tests/guard/guard.fwd21
-rw-r--r--tests/guard/test.mk1
2 files changed, 22 insertions, 0 deletions
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