summaryrefslogtreecommitdiff
path: root/test/matchbind.myr
diff options
context:
space:
mode:
Diffstat (limited to 'test/matchbind.myr')
-rw-r--r--test/matchbind.myr26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/matchbind.myr b/test/matchbind.myr
new file mode 100644
index 0000000..8d56185
--- /dev/null
+++ b/test/matchbind.myr
@@ -0,0 +1,26 @@
+type u = union
+ `Int int
+ `Chr char
+ `Nil
+;;
+
+const main = {
+ var v
+
+ v = `Int 11
+ match v
+ `Int 127:
+ -> 42
+ ;;
+ `Int (var x):
+ -> x
+ ;;
+ `Chr 'a':
+ -> 4
+ ;;
+ `Nil:
+ -> 6
+ ;;
+ ;;
+}
+