MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / test_closed

Function test_closed

flow-rs/src/channel/mod.rs:63–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61
62 #[rt::test]
63 async fn test_closed() {
64 let chan = ChannelStorage::unbound();
65 let r = chan.receiver();
66 let s = chan.sender();
67 s.close();
68 assert!(!r.is_closed());
69 assert!(r.recv_any().await.is_err());
70 assert!(r.is_closed());
71 chan.wait_rx_closed().await;
72
73 let chan = ChannelStorage::unbound();
74 let s = chan.sender();
75 let r = chan.receiver();
76 chan.close();
77 assert!(!r.is_closed());
78 assert!(r.recv_any().await.is_err());
79 assert!(r.is_closed());
80 drop(s);
81 chan.wait_tx_closed().await;
82 }
83}

Callers

nothing calls this directly

Calls 5

receiverMethod · 0.80
senderMethod · 0.80
wait_rx_closedMethod · 0.80
wait_tx_closedMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected