shithub: MicroHs

Download patch

ref: 90a309f6dda60b1d82444bdb7dddd182a2e1ecdc
parent: e65ebc123d5203c0bc9bb7da2e318ff4aa3143f2
author: Lennart Augustsson <lennart@augustsson.net>
date: Sun Nov 10 08:40:44 EST 2024

Add OrPatterns test.

--- a/tests/Makefile
+++ b/tests/Makefile
@@ -76,6 +76,7 @@
 	$(TMHS) NoForall   && $(EVAL) > NoForall.out   && diff NoForall.ref NoForall.out
 	$(TMHS) Bang       && $(EVAL) > Bang.out       && diff Bang.ref Bang.out
 	$(TMHS) MString    && $(EVAL) > MString.out    && diff MString.ref MString.out
+	$(TMHS) OrPat      && $(EVAL) > OrPat.out      && diff OrPat.ref OrPat.out
 
 errtest:
 	sh errtester.sh $(MHS) < errmsg.test
--- /dev/null
+++ b/tests/OrPat.hs
@@ -1,0 +1,10 @@
+module OrPat where
+
+data Sweet = Cupcake | Liquorice | Cookie | Raisins
+
+taste :: Sweet -> Bool
+tasty (Cupcake; Cookie) = True
+tasty (Liquorice; Raisins) = False
+
+main :: IO ()
+main = print $ map tasty [Cupcake, Liquorice, Cupcake, Raisins]
--- /dev/null
+++ b/tests/OrPat.ref
@@ -1,0 +1,1 @@
+[True,False,True,False]