aboutsummaryrefslogtreecommitdiffstats
path: root/match-test.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-01-11 19:49:48 -0800
committerRose Hogenson <rhogenson@posteo.net>2022-01-11 19:49:48 -0800
commitd1f378b7ed770f1ad78eb3e748f6ebc6c7024ef3 (patch)
treea4471ee93b9e94e3f01a3386e0afd7e74b79d6e1 /match-test.csc
parentWrite the linker. (diff)
downloadchromatopelma-d1f378b7ed770f1ad78eb3e748f6ebc6c7024ef3.tar.zst
Add guards to the match syntax.
I'm not sure the syntax is great, but it's very helpful to have.
Diffstat (limited to 'match-test.csc')
-rw-r--r--match-test.csc10
1 files changed, 10 insertions, 0 deletions
diff --git a/match-test.csc b/match-test.csc
index 73daa58..bbecce4 100644
--- a/match-test.csc
+++ b/match-test.csc
@@ -66,3 +66,13 @@
((! 'a) 1)
((! 'b) 2)
(_ 3))))
+
+
+(test match-when
+ (assert-equal
+ 3
+ (match 'b
+ ((! 'a) 1)
+ ((! 'b) (when #f) 2)
+ ((! 'b) 3)
+ (_ 4))))