1 | use futures::{ |
2 | executor::block_on, |
3 | future::{self, FutureExt}, |
4 | join, ready, |
5 | task::Poll, |
6 | try_join, |
7 | }; |
8 | |
9 | #[test] |
10 | fn ready() { |
11 | block_on(future::poll_fn(|_| { |
12 | ready!(Poll::Ready(()),); |
13 | Poll::Ready(()) |
14 | })) |
15 | } |
16 | |
17 | #[test] |
18 | fn poll() { |
19 | use futures::poll; |
20 | |
21 | block_on(async { |
22 | let _ = poll!(async {}.boxed(),); |
23 | }) |
24 | } |
25 | |
26 | #[test] |
27 | fn join() { |
28 | block_on(async { |
29 | let future1 = async { 1 }; |
30 | let future2 = async { 2 }; |
31 | join!(future1, future2,); |
32 | }) |
33 | } |
34 | |
35 | #[test] |
36 | fn try_join() { |
37 | block_on(async { |
38 | let future1 = async { 1 }.never_error(); |
39 | let future2 = async { 2 }.never_error(); |
40 | try_join!(future1, future2,) |
41 | }) |
42 | .unwrap(); |
43 | } |
44 | |