summaryrefslogtreecommitdiff
path: root/lib/bio
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-09-11 18:03:00 -0700
committerOri Bernstein <ori@eigenstate.org>2015-09-11 18:03:00 -0700
commitd2a4d99cee1cbff164e6b80560a0930043ba38a4 (patch)
treeea77141cdee3de78b83f31bb504be38d10b312c4 /lib/bio
parentbcae988a72a65bdc6597b3116a6a247e3df98487 (diff)
downloadmc-d2a4d99cee1cbff164e6b80560a0930043ba38a4.tar.gz
Update BIO tests and bootstrap.
Diffstat (limited to 'lib/bio')
-rw-r--r--lib/bio/test/bio-create.myr4
-rw-r--r--lib/bio/test/bio-delim.myr4
-rw-r--r--lib/bio/test/bio-endianrd.myr10
-rw-r--r--lib/bio/test/bio-endianwr.myr4
-rw-r--r--lib/bio/test/bio-peek.myr4
-rw-r--r--lib/bio/test/bio-read.myr11
-rw-r--r--lib/bio/test/bio-unitwr.myr4
-rw-r--r--lib/bio/test/bio-write.myr4
-rwxr-xr-xlib/bio/test/runtest.sh2
9 files changed, 26 insertions, 21 deletions
diff --git a/lib/bio/test/bio-create.myr b/lib/bio/test/bio-create.myr
index 6954e32..a15c9f0 100644
--- a/lib/bio/test/bio-create.myr
+++ b/lib/bio/test/bio-create.myr
@@ -6,8 +6,8 @@ const main = {
std.mkdir("tmpout", 0o755);
match bio.create("tmpout/test-create", bio.Wr, 0o644)
- | `std.Some bio: f = bio
- | `std.None: std.fatal(1, "Failed to open file\n")
+ | `std.Ok bio: f = bio
+ | `std.Fail m: std.fatal("Failed to open file: {}\n", m)
;;
bio.close(f)
}
diff --git a/lib/bio/test/bio-delim.myr b/lib/bio/test/bio-delim.myr
index 231c469..af9adf5 100644
--- a/lib/bio/test/bio-delim.myr
+++ b/lib/bio/test/bio-delim.myr
@@ -6,8 +6,8 @@ const main = {
var d
match bio.open("data/lines", bio.Rd)
- | `std.Some bio: f = bio
- | `std.None: std.fatal(1, "Unable to open data file\n")
+ | `std.Ok bio: f = bio
+ | `std.Fail m: std.fatal("Unable to open data file: {}\n", m)
;;
/* read first line */
diff --git a/lib/bio/test/bio-endianrd.myr b/lib/bio/test/bio-endianrd.myr
index 53743d8..6011496 100644
--- a/lib/bio/test/bio-endianrd.myr
+++ b/lib/bio/test/bio-endianrd.myr
@@ -4,7 +4,7 @@ use bio
generic try = {opt : std.option(@a::(integral,numeric))-> @a::(integral,numeric)
match opt
| `std.Some val: -> val
- | `std.None: std.fatal(1, "read failed")
+ | `std.None: std.fatal("read failed")
;;
}
const main = {
@@ -16,8 +16,8 @@ const main = {
/* use the expected write data as read data */
match bio.open("data/bio-endianwr-expected", bio.Rd)
- | `std.Some bio: f = bio
- | `std.None: std.fatal(1, "Unable to open data file")
+ | `std.Ok bio: f = bio
+ | `std.Fail m: std.fatal("Unable to open data file: {}\n", m)
;;
/* byte */
@@ -47,7 +47,9 @@ const main = {
/* end of file */
match bio.getle64(f)
| `std.None:
- | `std.Some v: std.die("read past end of file\n")
+ | `std.Some v:
+ std.die("read past end of file\n")
+ v = q /* shut up type inference */
;;
bio.close(f);
diff --git a/lib/bio/test/bio-endianwr.myr b/lib/bio/test/bio-endianwr.myr
index e44db49..b672571 100644
--- a/lib/bio/test/bio-endianwr.myr
+++ b/lib/bio/test/bio-endianwr.myr
@@ -9,8 +9,8 @@ const main = {
var f
match bio.create("tmpout/test-endianwr", bio.Wr, 0o644)
- | `std.Some bio: f = bio
- | `std.None: std.fatal(1, "Unable to open data file")
+ | `std.Ok bio: f = bio
+ | `std.Fail m: std.fatal("Unable to open data file: {}\n", m)
;;
/* byte */
diff --git a/lib/bio/test/bio-peek.myr b/lib/bio/test/bio-peek.myr
index 2125c9b..1f80f06 100644
--- a/lib/bio/test/bio-peek.myr
+++ b/lib/bio/test/bio-peek.myr
@@ -7,8 +7,8 @@ const main = {
var buf : byte[64*1024]
match bio.open("data/datafile", bio.Rd)
- | `std.Some bio: f = bio
- | `std.None: std.fatal(1, "Unable to open data file")
+ | `std.Ok bio: f = bio
+ | `std.Fail m: std.fatal("Unable to open data file: {}", m)
;;
std.assert(peekb(f) == 0x30, "wrong byte value read from datafile")
diff --git a/lib/bio/test/bio-read.myr b/lib/bio/test/bio-read.myr
index eafdb4a..2112d42 100644
--- a/lib/bio/test/bio-read.myr
+++ b/lib/bio/test/bio-read.myr
@@ -8,8 +8,8 @@ const main = {
var b
match bio.open("data/datafile", bio.Rd)
- | `std.Some bio: f = bio
- | `std.None: std.fatal(1, "Unable to open data file")
+ | `std.Ok bio: f = bio
+ | `std.Fail m: std.fatal("Unable to open data file: {}", m)
;;
/* read a 4 byte chunk j*/
@@ -40,7 +40,10 @@ const main = {
const r = {f, buf
match bio.read(f, buf)
- | `std.Some b: -> b
- | `std.None: std.put("eof\n")
+ | `std.Some b:
+ -> b
+ | `std.None:
+ std.put("eof\n")
+ -> ""
;;
}
diff --git a/lib/bio/test/bio-unitwr.myr b/lib/bio/test/bio-unitwr.myr
index 8a1774c..1a78e97 100644
--- a/lib/bio/test/bio-unitwr.myr
+++ b/lib/bio/test/bio-unitwr.myr
@@ -4,8 +4,8 @@ use bio
const main = {
var f
match bio.create("tmpout/test-unitwr", bio.Wr, 0o644)
- | `std.Some bio: f = bio
- | `std.None: std.fatal(1, "Unable to open data file")
+ | `std.Ok bio: f = bio
+ | `std.Fail m: std.fatal("Unable to open data file: {}\n", m)
;;
bio.putb(f, 42)
bio.putc(f, 'ה')
diff --git a/lib/bio/test/bio-write.myr b/lib/bio/test/bio-write.myr
index cbe7441..27a3f12 100644
--- a/lib/bio/test/bio-write.myr
+++ b/lib/bio/test/bio-write.myr
@@ -8,8 +8,8 @@ const main = {
var buf : byte[64*1024]
match bio.create("tmpout/test-write", bio.Wr, 0o644)
- | `std.Some bio: f = bio
- | `std.None: std.fatal(1, "Unable to open data file")
+ | `std.Ok bio: f = bio
+ | `std.Fail m: std.fatal("Unable to open data file: {}", m)
;;
/* write a 5 byte chunk */
diff --git a/lib/bio/test/runtest.sh b/lib/bio/test/runtest.sh
index 95f548f..f30ece2 100755
--- a/lib/bio/test/runtest.sh
+++ b/lib/bio/test/runtest.sh
@@ -4,7 +4,7 @@ NPASSES=0
function build {
rm -f $1 $1.o $1.s $1.use
- myrbuild $FLAGS -b $1 $1.myr $EXTRA_SRC
+ mbld $FLAGS -b $1 $1.myr $EXTRA_SRC
}
function pass {