shithub: mc

Download patch

ref: 00949c38a0f2a1dd742a0c568a53c2d68c85607b
parent: b9129f3f0281a4f382b5f437780076384aac826a
author: Ori Bernstein <[email protected]>
date: Thu Jun 12 10:03:02 EDT 2014

Add missing file.

--- /dev/null
+++ b/test/matchargstr.myr
@@ -1,0 +1,22 @@
+use std
+/* checks pattern matching on unions with arguments.
+exits with 42. */
+type u = union
+	`Int int
+	`Str byte[:]
+	`Nil
+;;
+
+const main = {
+	var v
+
+	v = `Str "asdf"
+	match v
+	| `Int 127:	std.fatal(1, "wrong match `Int 127\n")
+	| `Str "foo":	std.fatal(1, "Wrong match `Str \"foo\"\n")
+	| `Str "fsda":	std.fatal(1, "Wrong match `Str \"fsda\"\n")
+	| `Str "asdf":	std.put("Correct `Str \"asdf\"!\n")
+	| `Nil:		std.fatal(1, "Wrong match `Str \"fsda\"\n")
+	;;
+}
+