Debian Codegraph @

third_party/rust/tokio/tests/task_yield_now.rs

raw
1 #![allow(unknown_lints, unexpected_cfgs)]
2 #![cfg(all(feature = "full", tokio_unstable))]
3
4 use tokio::task;
5 use tokio_test::task::spawn;
6
7 // `yield_now` is tested within the runtime in `rt_common`.
8 #[test]
9 fn yield_now_outside_of_runtime() {
10 let mut task = spawn(async {
11 task::yield_now().await;
12 });
13
14 assert!(task.poll().is_pending());
15 assert!(task.is_woken());
16 assert!(task.poll().is_ready());
17 }