aboutsummaryrefslogtreecommitdiff
path: root/vendor/flume/tests/method_sharing.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
committerValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
commit1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch)
tree7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/flume/tests/method_sharing.rs
parent5ecd8cf2cba827454317368b68571df0d13d7842 (diff)
downloadfparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz
fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/flume/tests/method_sharing.rs')
-rw-r--r--vendor/flume/tests/method_sharing.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/flume/tests/method_sharing.rs b/vendor/flume/tests/method_sharing.rs
new file mode 100644
index 0000000..24173ea
--- /dev/null
+++ b/vendor/flume/tests/method_sharing.rs
@@ -0,0 +1,39 @@
+#[cfg(feature = "async")]
+use flume::*;
+
+#[cfg(feature = "async")]
+#[async_std::test]
+async fn sender() {
+ let (sender, receiver) = bounded(1);
+
+ let sender_fut = sender.send_async(());
+ assert_eq!(sender.is_disconnected(), sender_fut.is_disconnected());
+ assert_eq!(sender.is_empty(), sender_fut.is_empty());
+ assert_eq!(sender.is_full(), sender_fut.is_full());
+ assert_eq!(sender.len(), sender_fut.len());
+ assert_eq!(sender.capacity(), sender_fut.capacity());
+
+ let sender_sink = sender.sink();
+ assert_eq!(sender.is_disconnected(), sender_sink.is_disconnected());
+ assert_eq!(sender.is_empty(), sender_sink.is_empty());
+ assert_eq!(sender.is_full(), sender_sink.is_full());
+ assert_eq!(sender.len(), sender_sink.len());
+ assert_eq!(sender.capacity(), sender_sink.capacity());
+
+ let receiver_fut = receiver.recv_async();
+ assert_eq!(receiver.is_disconnected(), receiver_fut.is_disconnected());
+ assert_eq!(receiver.is_empty(), receiver_fut.is_empty());
+ assert_eq!(receiver.is_full(), receiver_fut.is_full());
+ assert_eq!(receiver.len(), receiver_fut.len());
+ assert_eq!(receiver.capacity(), receiver_fut.capacity());
+
+ let receiver_stream = receiver.stream();
+ assert_eq!(
+ receiver.is_disconnected(),
+ receiver_stream.is_disconnected()
+ );
+ assert_eq!(receiver.is_empty(), receiver_stream.is_empty());
+ assert_eq!(receiver.is_full(), receiver_stream.is_full());
+ assert_eq!(receiver.len(), receiver_stream.len());
+ assert_eq!(receiver.capacity(), receiver_stream.capacity());
+}