ref: b79e739ffcf4a2d7c6c177a257c63a24c7bc844f
parent: 4c4a81a00c9265c4279f9442564c37f30df3fd63
author: Ori Bernstein <[email protected]>
date: Mon Sep 23 13:24:54 EDT 2013
Some renaming and test addition.
--- /dev/null
+++ b/test/stdopt-mk.myr
@@ -1,0 +1,15 @@
+use std
+
+const main = {args : byte[:][:]
+ match getoption(123)
+ `std.Some val: std.put("Got a value: %i\n", val);;
+ `std.None: std.put("No value returned\n");;
+ ;;
+}
+
+const getoption = {val
+ match val
+ 0: -> `std.None;;
+ _: -> `std.Some val;;
+ ;;
+}
--- /dev/null
+++ b/test/stdopt-none.myr
@@ -1,0 +1,13 @@
+use std
+
+const f = {
+ -> `std.None
+}
+
+const main = {
+ match f()
+ `std.Some x: -> x;;
+ `std.None: -> 42;;
+ ;;
+}
+
--- /dev/null
+++ b/test/stdopt-some.myr
@@ -1,0 +1,9 @@
+use std
+
+const main = {
+ match `std.Some 42
+ `std.Some x: -> x;;
+ `std.None: -> 1;;
+ ;;
+}
+
--- a/test/stdoption-none.myr
+++ /dev/null
@@ -1,13 +1,0 @@
-use std
-
-const f = {
- -> `std.None
-}
-
-const main = {
- match f()
- `std.Some x: -> x;;
- `std.None: -> 42;;
- ;;
-}
-
--- a/test/stdoption-some.myr
+++ /dev/null
@@ -1,9 +1,0 @@
-use std
-
-const main = {
- match `std.Some 42
- `std.Some x: -> x;;
- `std.None: -> 1;;
- ;;
-}
-
--- a/test/tests
+++ b/test/tests
@@ -64,8 +64,9 @@
B genericret E 42
B genericmatch E 15
B genericrec E 0
-B stdoption-some E 42
-B stdoption-none E 42
+B stdopt-some E 42
+B stdopt-none E 42
+B stdopt-mk E 42
B sizeof E 4
B gsizeof E 5
B mkunion E 0