diff options
Diffstat (limited to 'third_party/rust/tokio/tests/io_chain.rs')
-rw-r--r-- | third_party/rust/tokio/tests/io_chain.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/third_party/rust/tokio/tests/io_chain.rs b/third_party/rust/tokio/tests/io_chain.rs new file mode 100644 index 0000000000..e2d59411a1 --- /dev/null +++ b/third_party/rust/tokio/tests/io_chain.rs @@ -0,0 +1,16 @@ +#![warn(rust_2018_idioms)] +#![cfg(feature = "full")] + +use tokio::io::AsyncReadExt; +use tokio_test::assert_ok; + +#[tokio::test] +async fn chain() { + let mut buf = Vec::new(); + let rd1: &[u8] = b"hello "; + let rd2: &[u8] = b"world"; + + let mut rd = rd1.chain(rd2); + assert_ok!(rd.read_to_end(&mut buf).await); + assert_eq!(buf, b"hello world"); +} |