summaryrefslogtreecommitdiffstats
path: root/tokio/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/tests')
-rw-r--r--tokio/tests/sync_mpsc.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tokio/tests/sync_mpsc.rs b/tokio/tests/sync_mpsc.rs
index f571a71c..919bddbf 100644
--- a/tokio/tests/sync_mpsc.rs
+++ b/tokio/tests/sync_mpsc.rs
@@ -534,3 +534,25 @@ async fn blocking_send_async() {
let (mut tx, _rx) = mpsc::channel::<()>(1);
let _ = tx.blocking_send(());
}
+
+#[test]
+fn ready_close_cancel_bounded() {
+ use futures::future::poll_fn;
+
+ let (mut tx, mut rx) = mpsc::channel::<()>(100);
+ let _tx2 = tx.clone();
+
+ {
+ let mut ready = task::spawn(async { poll_fn(|cx| tx.poll_ready(cx)).await });
+ assert_ready_ok!(ready.poll());
+ }
+
+ rx.close();
+
+ let mut recv = task::spawn(async { rx.recv().await });
+ assert_pending!(recv.poll());
+
+ drop(tx);
+
+ assert!(recv.is_woken());
+}