aboutsummaryrefslogtreecommitdiff
path: root/tests/guard
diff options
context:
space:
mode:
Diffstat (limited to 'tests/guard')
-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