summaryrefslogtreecommitdiff
path: root/test/matchargunion.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-06-29 20:11:02 -0400
committerOri Bernstein <ori@eigenstate.org>2012-06-29 20:11:02 -0400
commitbfa86d22fdc7b22fa4bc2819d4aa928acfac5168 (patch)
tree4046103613ad4ab0a235fedc490271940973b9e1 /test/matchargunion.myr
parentc246138e19efb1949e562717653adf9e41067fa5 (diff)
downloadmc-bfa86d22fdc7b22fa4bc2819d4aa928acfac5168.tar.gz
Add test for unions with args
Diffstat (limited to 'test/matchargunion.myr')
-rw-r--r--test/matchargunion.myr26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/matchargunion.myr b/test/matchargunion.myr
new file mode 100644
index 0000000..48fb6f9
--- /dev/null
+++ b/test/matchargunion.myr
@@ -0,0 +1,26 @@
+type u = union
+ `Int int
+ `Chr char
+ `Nil
+;;
+
+const main = {
+ var v
+
+ v = `Int 123
+ match v
+ `Int 127:
+ -> 42
+ ;;
+ `Int 123:
+ -> 69
+ ;;
+ `Chr 'a':
+ -> 4
+ ;;
+ `Nil:
+ -> 6
+ ;;
+ ;;
+}
+