summaryrefslogtreecommitdiff
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
parentc246138e19efb1949e562717653adf9e41067fa5 (diff)
downloadmc-bfa86d22fdc7b22fa4bc2819d4aa928acfac5168.tar.gz
Add test for unions with args
-rw-r--r--test/matchargunion.myr26
-rw-r--r--test/tests1
2 files changed, 27 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
+ ;;
+ ;;
+}
+
diff --git a/test/tests b/test/tests
index 9d9aa07..bb1e787 100644
--- a/test/tests
+++ b/test/tests
@@ -42,6 +42,7 @@ B gsizeof E 5
B mkunion E 0
B matchint E 84
B matchunion E 84
+B matchargunion E 69
F declmismatch
F infermismatch
F flow