aboutsummaryrefslogtreecommitdiff
path: root/vendor/flume/tests/check_same_channel.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/check_same_channel.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/check_same_channel.rs')
-rw-r--r--vendor/flume/tests/check_same_channel.rs57
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/flume/tests/check_same_channel.rs b/vendor/flume/tests/check_same_channel.rs
new file mode 100644
index 0000000..edb82c3
--- /dev/null
+++ b/vendor/flume/tests/check_same_channel.rs
@@ -0,0 +1,57 @@
+#[test]
+fn same_sender() {
+ let (tx1, _rx) = flume::unbounded::<()>();
+ let tx2 = tx1.clone();
+
+ assert!(tx1.same_channel(&tx2));
+
+ let (tx3, _rx) = flume::unbounded::<()>();
+
+ assert!(!tx1.same_channel(&tx3));
+ assert!(!tx2.same_channel(&tx3));
+}
+
+#[test]
+fn same_receiver() {
+ let (_tx, rx1) = flume::unbounded::<()>();
+ let rx2 = rx1.clone();
+
+ assert!(rx1.same_channel(&rx2));
+
+ let (_tx, rx3) = flume::unbounded::<()>();
+
+ assert!(!rx1.same_channel(&rx3));
+ assert!(!rx2.same_channel(&rx3));
+}
+
+#[cfg(feature = "async")]
+#[test]
+fn same_send_sink() {
+ let (tx1, _rx) = flume::unbounded::<()>();
+ let tx1 = tx1.into_sink();
+ let tx2 = tx1.clone();
+
+ assert!(tx1.same_channel(&tx2));
+
+ let (tx3, _rx) = flume::unbounded::<()>();
+ let tx3 = tx3.into_sink();
+
+ assert!(!tx1.same_channel(&tx3));
+ assert!(!tx2.same_channel(&tx3));
+}
+
+#[cfg(feature = "async")]
+#[test]
+fn same_recv_stream() {
+ let (_tx, rx1) = flume::unbounded::<()>();
+ let rx1 = rx1.into_stream();
+ let rx2 = rx1.clone();
+
+ assert!(rx1.same_channel(&rx2));
+
+ let (_tx, rx3) = flume::unbounded::<()>();
+ let rx3 = rx3.into_stream();
+
+ assert!(!rx1.same_channel(&rx3));
+ assert!(!rx2.same_channel(&rx3));
+}