diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2019-11-03 14:21:01 +0200 |
---|---|---|
committer | Taiki Endo <te316e89@gmail.com> | 2019-11-03 21:21:01 +0900 |
commit | 6b35a1e8b0d53524af8d07f99cf85ae81a73ef18 (patch) | |
tree | 0e3e7b232f8def9d992098ebffa9cf762e9be76d /tokio/tests | |
parent | e19bd77ef0149b3141981b36f3ebc442fae4a0b4 (diff) |
impl AsyncWrite for std::io::Cursor (#1730)
Based on the implementation from the futures crate.
Diffstat (limited to 'tokio/tests')
-rw-r--r-- | tokio/tests/io_write.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tokio/tests/io_write.rs b/tokio/tests/io_write.rs index 733b38c9..15c5be7c 100644 --- a/tokio/tests/io_write.rs +++ b/tokio/tests/io_write.rs @@ -44,3 +44,14 @@ async fn write() { assert_eq!(n, 4); assert_eq!(wr.buf, b"hell"[..]); } + +#[tokio::test] +async fn write_cursor() { + use std::io::Cursor; + + let mut wr = Cursor::new(Vec::new()); + + let n = assert_ok!(wr.write(b"hello world").await); + assert_eq!(n, 11); + assert_eq!(wr.get_ref().as_slice(), &b"hello world"[..]); +} |