| 1 | use futures::io::Cursor; |
| 2 | use futures::{executor, TryStreamExt}; |
| 3 | use futures_codec::{FramedRead, LinesCodec}; |
| 4 | |
| 5 | #[test] |
| 6 | fn it_works() { |
| 7 | let buf = "Hello\nWorld\nError".to_owned(); |
| 8 | let cur = Cursor::new(buf); |
| 9 | |
| 10 | let mut framed = FramedRead::new(cur, LinesCodec {}); |
| 11 | let next = executor::block_on(framed.try_next()).unwrap().unwrap(); |
| 12 | assert_eq!(next, "Hello\n"); |
| 13 | let next = executor::block_on(framed.try_next()).unwrap().unwrap(); |
| 14 | assert_eq!(next, "World\n"); |
| 15 | |
| 16 | assert!(executor::block_on(framed.try_next()).is_err()); |
| 17 | } |