mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-23 16:21:06 +01:00
unread_data tests
This commit is contained in:
parent
d49e61591f
commit
5f90d0bcd6
@ -563,4 +563,23 @@ mod test {
|
||||
result(res)
|
||||
})).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unread_data() {
|
||||
Core::new().unwrap().run(lazy(|| {
|
||||
let (_, mut payload) = Payload::new(false);
|
||||
|
||||
payload.unread_data(Bytes::from("data"));
|
||||
assert!(!payload.is_empty());
|
||||
assert_eq!(payload.len(), 4);
|
||||
|
||||
match payload.readany() {
|
||||
Async::Ready(Some(data)) => assert_eq!(&data.unwrap(), "data"),
|
||||
_ => panic!("error"),
|
||||
}
|
||||
|
||||
let res: Result<(), ()> = Ok(());
|
||||
result(res)
|
||||
})).unwrap();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user