@std/test/iotest.ms#
Import each required symbol with import Name from "@std/test/iotest.ms".
check_reader Function#
Checks that make builds a well-behaved ReadStream[Bytes] over exactly
expected: whole reads, one-byte reads, and an end of input that stays ended.
make is called once per check, so each check starts from the beginning. Fails the
test if any check does not hold.
fn check_reader(make fn() ReadStream[Bytes], expected Bytes, site String = caller_site()) Result[Void, Error] { ... }fail_after Function#
Returns a stream that delivers after bytes of input and then fails every read
with cause, even if input has ended. Use it to check that a parser reports a
truncated or broken source instead of treating it as a clean end of input.
fn fail_after(move input ReadStream[Bytes], after Int, move cause Error) ReadStream[Bytes] { ... }fail_writer_after Function#
Returns a writer that passes after bytes through to output, writes the part of
the write that fits under the limit, and then fails that write and every later one
with cause. Use it to check error handling on a full disk or closed pipe.
fn fail_writer_after(move output WriteStream[Bytes], after Int, move cause Error) WriteStream[Bytes] { ... }one_byte Function#
Returns input limited to one byte per read. This exposes code that assumes a read
fills its buffer.
fn one_byte(move input ReadStream[Bytes]) ReadStream[Bytes] { ... }