mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
30 lines
614 B
Rust
30 lines
614 B
Rust
#![cfg(feature = "broken")]
|
|
use futures::Async::*;
|
|
use std::io::Cursor;
|
|
use tokio_buf::{util, BufStream};
|
|
|
|
mod support;
|
|
|
|
type Buf = Cursor<&'static [u8]>;
|
|
|
|
#[test]
|
|
fn empty_iter() {
|
|
let mut bs = util::iter(Vec::<Buf>::new());
|
|
assert_none!(bs.poll_buf());
|
|
}
|
|
|
|
#[test]
|
|
fn full_iter() {
|
|
let bufs = vec![buf(b"one"), buf(b"two"), buf(b"three")];
|
|
|
|
let mut bs = util::iter(bufs);
|
|
assert_buf_eq!(bs.poll_buf(), "one");
|
|
assert_buf_eq!(bs.poll_buf(), "two");
|
|
assert_buf_eq!(bs.poll_buf(), "three");
|
|
assert_none!(bs.poll_buf());
|
|
}
|
|
|
|
fn buf(data: &'static [u8]) -> Buf {
|
|
Cursor::new(data)
|
|
}
|