Install
Install from crates.io
[dependencies]
futures-mockstream = "0.1"
Example
with smol
use futures- MockStream;
use smol;
Install from crates.io
[dependencies]
futures-mockstream = "0.1"
with smol
use futures-mockStream::MockStream;
use smol;
#[cfg(test)]
mod tests {
#[test]
fn async_read() {
smol::run(async {
let mut mockstream = MockStream::from(&b"GET /index HTTP/1.1\r\n");
while let Some(resp) = MyConn::with_stream(mockstream).next().await {
match resp {
Ok(r) => { // your asserts },
Err(e) => {},
}
}
})
}
}