1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-12-12 15:20:24 +01:00

unread_data tests

This commit is contained in:
Nikolay Kim 2017-10-22 20:19:20 -07:00
parent d49e61591f
commit 5f90d0bcd6

View File

@ -563,4 +563,23 @@ mod test {
result(res) result(res)
})).unwrap(); })).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();
}
} }