shithub: mc

ref: 26ac18e94d9f64f5153c51cf6d6151367ea0dfd7
dir: /lib/bio/test/mem.myr/

View raw version
use std
use bio

const main = {
	var f
	var buf : byte[16]

	f = bio.mkmem("hello world")
	match bio.read(f, buf[:3])
	| `std.Ok "hel":
		/* ok */
	| _:
		std.fatal("invalid read from memfile")
	;;

	match bio.read(f, buf[:])
	| `std.Ok "lo world":
		/* ok */
	| _:
		std.fatal("invalid read from memfile")
	;;

	match bio.read(f, buf[:])
	| `std.Err `bio.Eof:
		/* ok */
	| _:
		std.fatal("expected eof in memfile")
	;;
}