1 | #![warn(rust_2018_idioms)] |
---|---|
2 | #![cfg(feature = "full")] |
3 | |
4 | use tokio::io::AsyncReadExt; |
5 | use tokio_test::assert_ok; |
6 | |
7 | #[tokio::test] |
8 | async fn chain() { |
9 | let mut buf = Vec::new(); |
10 | let rd1: &[u8] = b"hello "; |
11 | let rd2: &[u8] = b"world"; |
12 | |
13 | let mut rd = rd1.chain(rd2); |
14 | assert_ok!(rd.read_to_end(&mut buf).await); |
15 | assert_eq!(buf, b"hello world"); |
16 | } |
17 |