1 unstable release
Uses old Rust 2015
0.1.0 | Oct 12, 2017 |
---|
#83 in #io-read
Used in game-of-life-parsers
3KB
IO Test Util
Collection of utilities for testing failure of io components, e.g. std::io::Read
.
Usage
In your Cargo.toml:
[dev-dependencies]
io-test-util = "*"
In your test:
extern crate io_test_util;
use io_test_util::ErrReader;
use std::io::{ErrorKind, Read};
pub fn main() {
let mut reader = ErrReader::new(ErrorKind::BrokenPipe);
let res = reader.read(&mut[0; 1]);
assert!(res.is_err());
}
lib.rs
:
Collection of utilities for testing failure of io components, e.g. std::io::Read
.
Usage
In your Cargo.toml:
[dev-dependencies]
io-test-util = "*"
In your test:
extern crate io_test_util;
use io_test_util::ErrReader;
use std::io::{ErrorKind, Read};
pub fn main() {
let mut reader = ErrReader::new(ErrorKind::BrokenPipe);
let res = reader.read(&mut[0; 1]);
assert!(res.is_err());
}