ref: 8f6bfd8f7bf8c5ca162bdf49a94570e21e03ba3a
parent: 28c435e97cdf2adbd3bf9f75f879f42b47fee737
author: Ori Bernstein <[email protected]>
date: Wed Dec 18 11:46:24 EST 2013
More testing work.
--- a/test/bio-create.myr
+++ b/test/bio-create.myr
@@ -5,7 +5,7 @@
var f
std.mkdir("tmpout", 0o755);
- match bio.create("tmpout/test-create", bio.Wr, 0o777)
+ match bio.create("tmpout/test-create", bio.Wr, 0o644)
| `std.Some bio: f = bio
| `std.None: std.fatal(1, "Failed to open file\n")
;;
--- a/test/bio-endianwr.myr
+++ b/test/bio-endianwr.myr
@@ -8,7 +8,7 @@
var q : uint64
var f
- match bio.open("tmpout/test-endianwr", bio.Wr)
+ match bio.create("tmpout/test-endianwr", bio.Wr, 0o644)
| `std.Some bio: f = bio
| `std.None: std.fatal(1, "Unable to open data file")
;;
--- /dev/null
+++ b/test/bio-unitwr.myr
@@ -1,0 +1,25 @@
+use std
+use bio
+
+const main = {
+ var f
+ /* Must be bigger than a bio buffer (ie, > 64k) */
+ var buf : byte[64*1024]
+
+ match bio.create("tmpout/test-unitwr", bio.Wr, 0o644)
+ | `std.Some bio: f = bio
+ | `std.None: std.fatal(1, "Unable to open data file")
+ ;;
+
+ /* write a byte */
+ bio.putb(f, 42)
+
+ /* and a char */
+ bio.putc(f, 'ה')
+
+ /* write a byte */
+ bio.putb(f, 0xa)
+
+ /* and test for flush on close */
+ bio.close(f);
+}
--- a/test/bio-write.myr
+++ b/test/bio-write.myr
@@ -7,7 +7,7 @@
/* Must be bigger than a bio buffer (ie, > 64k) */
var buf : byte[64*1024]
- match bio.open("tmpout/test-write", bio.Wr)
+ match bio.create("tmpout/test-write", bio.Wr, 0o644)
| `std.Some bio: f = bio
| `std.None: std.fatal(1, "Unable to open data file")
;;
--- /dev/null
+++ b/test/data/bio-unit-expected
@@ -1,0 +1,1 @@
+*ה
--- a/test/tests
+++ b/test/tests
@@ -1,4 +1,5 @@
FLAGS=-I../
+mkdir -p tmpout
# Format:
# [B|F] testname [E|P] result
# [B|F]: Compiler outcome.
@@ -25,6 +26,6 @@
B bio-delim C
B bio-endianwr F tmpout/test-endianwr
B bio-endianrd C
-#B bio-unit C
+B bio-unitwr F tmpout/test-unitwr
#B bio-peek C
#B bio-fmt C