iostub
iostub is a small and ready to use rust library to stub std::io::Read in test suites.
usage
IOStub allow you to provide a object implementing std::io::Read which can be consumed by your test subject and still allow you to push data or errors trough it.
let mut stub = new;
let mut cr = new;
stub.push_read;
stub.push_read;
stub.push_read;
let rv = cr.read_all;
assert!;
assert_eq!;
let rv = cr.read_all;
assert!;
assert_eq!;
stub.push_read;
stub.push_read;
stub.push_read;
let rv = cr.read_all;
assert!;
assert_eq!
stub.push_read_error;
let rv = cr.read_one;
assert!;
let e = rv.unwrap_err;
assert_eq!;
caution
This library was designed for testing purposes and is not optimised for anything else.