futures: tests/macro_comma_support.rs: Don't break w/o features
Symbols/Imports pushed down / localised
Tests gated with cfg()
Tests now build and pass with all valid feature combinations
See previous commits for details and rationale
-#[macro_use]
-extern crate futures;
-
+#[cfg(feature = "executor")]
+#[test]
+fn ready() {
use futures::{
executor::block_on,
- future::{self, FutureExt},
+ future,
task::Poll,
+ ready,
};
-#[test]
-fn ready() {
block_on(future::poll_fn(|_| {
ready!(Poll::Ready(()),);
Poll::Ready(())
}))
}
+#[cfg(all(feature = "executor", feature = "async-await"))]
#[test]
fn poll() {
+ use futures::{
+ executor::block_on,
+ future::FutureExt,
+ poll,
+ };
+
block_on(async {
let _ = poll!(async {}.boxed(),);
})
}
+#[cfg(all(feature = "executor", feature = "async-await"))]
#[test]
fn join() {
+ use futures::{
+ executor::block_on,
+ join
+ };
+
block_on(async {
let future1 = async { 1 };
let future2 = async { 2 };
@@ -31,8 +43,15 @@ fn join() {
})
}
+#[cfg(all(feature = "executor", feature = "async-await"))]
#[test]
fn try_join() {
+ use futures::{
+ executor::block_on,
+ future::FutureExt,
+ try_join,
+ };
+
block_on(async {
let future1 = async { 1 }.never_error();
let future2 = async { 2 }.never_error();
