1#![warn(rust_2018_idioms)]
2
3use tokio::time::{sleep_until, Duration, Instant};
4use tokio_test::block_on;
5
6#[test]
7fn async_block() {
8 assert_eq!(4, block_on(async { 4 }));
9}
10
11async fn five() -> u8 {
12 5
13}
14
15#[test]
16fn async_fn() {
17 assert_eq!(5, block_on(five()));
18}
19
20#[test]
21fn test_sleep() {
22 let deadline = Instant::now() + Duration::from_millis(100);
23
24 block_on(async {
25 sleep_until(deadline).await;
26 });
27}
28