summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2019-10-23 15:41:01 -0700
committerOri Bernstein <ori@eigenstate.org>2019-10-23 15:41:01 -0700
commit076f4d371d887d25c3ac3851589f161131f57c88 (patch)
tree20554a62b41c0b4bd3596a16ec7b8943ed97aac2
parentcebd9262172a94782ffadd1ebc2bf66dfee971e1 (diff)
downloadmc-076f4d371d887d25c3ac3851589f161131f57c88.tar.gz
Add missing file.
-rw-r--r--test/matchctup.myr32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/matchctup.myr b/test/matchctup.myr
new file mode 100644
index 0000000..07d51e6
--- /dev/null
+++ b/test/matchctup.myr
@@ -0,0 +1,32 @@
+use std
+
+const main = {
+ match (gen_a(), gen_b())
+ | (`std.Err _, _): std.put("error case 1")
+ | (_, `std.Err _): std.put("error case 2")
+ | (`std.Ok L, `std.Ok N):
+ std.put("l = {} n = {}\n", L, N)
+ ;;
+}
+
+var gen_a : (-> std.result(byte[:][:], void)) = {
+ var ret = [][:]
+
+ for var j = 0; j < 4; ++j
+ std.slpush(&ret, std.fmt("{}", j))
+ ;;
+
+ if 1 + 1 > 3
+ -> `std.Err void
+ ;;
+
+ -> `std.Ok ret
+}
+
+var gen_b : (-> std.result(int, void)) = {
+ if 1 + 1 > 3
+ -> `std.Err void
+ ;;
+
+ -> `std.Ok 5
+}