aboutsummaryrefslogtreecommitdiffstats
path: root/match-test.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-01-11 21:52:57 -0800
committerRose Hogenson <rhogenson@posteo.net>2022-01-11 21:52:57 -0800
commitc5fc92c75205051ce01bba1781cd1c4ba0907765 (patch)
tree2ebd286d8393144dfb600687d9c8f958f5edcbcb /match-test.csc
parentAdd guards to the match syntax. (diff)
downloadchromatopelma-c5fc92c75205051ce01bba1781cd1c4ba0907765.tar.zst
Make bindings visible while a guard is evaluated.
The current implementation repeats the bindings twice, but I guess it's fine. It seems to work.
Diffstat (limited to 'match-test.csc')
-rw-r--r--match-test.csc11
1 files changed, 10 insertions, 1 deletions
diff --git a/match-test.csc b/match-test.csc
index bbecce4..31e7afa 100644
--- a/match-test.csc
+++ b/match-test.csc
@@ -74,5 +74,14 @@
(match 'b
((! 'a) 1)
((! 'b) (when #f) 2)
- ((! 'b) 3)
+ ((! 'b) (when #t) 3)
(_ 4))))
+
+
+(test match-when-depending-on-pattern-variable
+ (assert-equal
+ 2
+ (match 10
+ (n (when (= 1 n)) 1)
+ (n (when (= 10 n)) 2)
+ (_ 3))))