A Rust utility library to help test I/O code. mock-io
provides a type
implementing Read
and Write
that can be configured to follow a predefined
script and panic otherwise.
Add this to your Cargo.toml
:
[dev-dependencies]
mock-io = { git = "https://github.com/carllerche/mock-io" }
Next, add this to your tests:
extern crate mock_io;
Now you can use mock-io
in your tests.
mock-io
provides Tokio support by default. This can be disabled by ommitting
the tokio
feature.
mock-io
is primarily distributed under the terms of both the MIT license and
the Apache License (Version 2.0), with portions covered by various BSD-like
licenses.
See LICENSE-APACHE, and LICENSE-MIT for details.