diff options
Diffstat (limited to 'tests/io_cursor.rs')
-rw-r--r-- | tests/io_cursor.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/io_cursor.rs b/tests/io_cursor.rs index 4f80a75..0a93c83 100644 --- a/tests/io_cursor.rs +++ b/tests/io_cursor.rs @@ -1,11 +1,12 @@ -use assert_matches::assert_matches; -use futures::future::lazy; -use futures::io::{AsyncWrite, Cursor}; -use futures::task::Poll; -use std::pin::Pin; - +#[cfg(all(feature = "std", feature = "executor"))] #[test] fn cursor_asyncwrite_vec() { + use assert_matches::assert_matches; + use futures::future::lazy; + use futures::io::{AsyncWrite, Cursor}; + use futures::task::Poll; + use std::pin::Pin; + let mut cursor = Cursor::new(vec![0; 5]); futures::executor::block_on(lazy(|cx| { assert_matches!(Pin::new(&mut cursor).poll_write(cx, &[1, 2]), Poll::Ready(Ok(2))); @@ -16,8 +17,15 @@ fn cursor_asyncwrite_vec() { assert_eq!(cursor.into_inner(), [1, 2, 3, 4, 5, 6, 6, 7]); } +#[cfg(all(feature = "std", feature = "executor"))] #[test] fn cursor_asyncwrite_box() { + use assert_matches::assert_matches; + use futures::future::lazy; + use futures::io::{AsyncWrite, Cursor}; + use futures::task::Poll; + use std::pin::Pin; + let mut cursor = Cursor::new(vec![0; 5].into_boxed_slice()); futures::executor::block_on(lazy(|cx| { assert_matches!(Pin::new(&mut cursor).poll_write(cx, &[1, 2]), Poll::Ready(Ok(2))); |