io-test-util

Crates.ioio-test-util
lib.rsio-test-util
version0.1.0
sourcesrc
created_at2017-10-12 19:31:57.205869
updated_at2017-10-12 19:31:57.205869
descriptionCollection of utilities for testing failure of io components.
homepagehttps://github.com/Leopard2A5/rust-io-test-util
repository
max_upload_size
id35443
size2,307
René Perschon (Leopard2A5)

documentation

https://docs.rs/io-test-util/

README

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());
}
Commit count: 0

cargo fmt