()
| 384 | |
| 385 | #[tokio::test] |
| 386 | async fn cancel_safety() { |
| 387 | let (tx, rx) = create(2); |
| 388 | tx.send(1).unwrap(); |
| 389 | |
| 390 | tokio::select! { |
| 391 | biased; |
| 392 | _ = async {} => { |
| 393 | // The empty branch should complete first |
| 394 | } |
| 395 | _ = rx.recv() => { |
| 396 | panic!("This branch should not complete first"); |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | // The value should still be available |
| 401 | assert_eq!(rx.recv().await.unwrap(), 1); |
| 402 | } |
| 403 | |
| 404 | // nothing async, but needs tokio runtime due to inner notify |
| 405 | #[tokio::test] |