1 | #![warn (rust_2018_idioms)] |
2 | #![cfg (feature = "full" )] |
3 | |
4 | use tokio::io::AsyncBufReadExt; |
5 | use tokio_test::assert_ok; |
6 | |
7 | #[tokio::test ] |
8 | async fn lines_inherent() { |
9 | let rd: &[u8] = b"hello \r\nworld \n\n" ; |
10 | let mut st = rd.lines(); |
11 | |
12 | let b = assert_ok!(st.next_line().await).unwrap(); |
13 | assert_eq!(b, "hello" ); |
14 | let b = assert_ok!(st.next_line().await).unwrap(); |
15 | assert_eq!(b, "world" ); |
16 | let b = assert_ok!(st.next_line().await).unwrap(); |
17 | assert_eq!(b, "" ); |
18 | assert!(assert_ok!(st.next_line().await).is_none()); |
19 | } |
20 | |