summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-10-21 21:37:23 -0400
committerOri Bernstein <ori@eigenstate.org>2013-10-21 21:37:23 -0400
commitc3955db0543c35b4adb822f5beca686e8c3726ef (patch)
treeafcb56c050f63de5661a63eea41b7b8970fd1527 /test
parentf1383ff55a560228d15cf59dabba30dee3e3daeb (diff)
downloadmc-c3955db0543c35b4adb822f5beca686e8c3726ef.tar.gz
Add tests for the new match types
Diffstat (limited to 'test')
-rw-r--r--test/matcharray.myr13
-rw-r--r--test/matchstruct.myr24
-rw-r--r--test/tests1
3 files changed, 38 insertions, 0 deletions
diff --git a/test/matcharray.myr b/test/matcharray.myr
new file mode 100644
index 0000000..67e8efe
--- /dev/null
+++ b/test/matcharray.myr
@@ -0,0 +1,13 @@
+use std
+
+const main = {
+ var v = [2, 40, 10]
+
+ match v
+ [x, y, 10]:
+ -> x + y
+ ;;
+ _: std.die("Wat");;
+ ;;
+ -> 0
+}
diff --git a/test/matchstruct.myr b/test/matchstruct.myr
new file mode 100644
index 0000000..38bc5e0
--- /dev/null
+++ b/test/matchstruct.myr
@@ -0,0 +1,24 @@
+use std
+
+type t = struct
+ v1 : int
+ v2 : int
+ v3 : int
+;;
+
+const main = {
+ var v : t
+
+ v.v1 = 2
+ v.v2 = 40
+ v.v3 = 10
+ match v
+ [.v1 = x,
+ .v2 = y,
+ .v3 = 10]:
+ -> x + y
+ ;;
+ _: std.die("Wat");;
+ ;;
+ -> 0
+}
diff --git a/test/tests b/test/tests
index 9bff4ca..8dcef5d 100644
--- a/test/tests
+++ b/test/tests
@@ -83,6 +83,7 @@ B matchconst E 88
B matchunion E 84
B matchtup E 42
B matchstruct E 42
+B matcharray E 42
B matchargunion E 69
B matchunion_sl P foo
B matchbind E 8