summaryrefslogtreecommitdiffstats
path: root/tokio/tests
diff options
context:
space:
mode:
authorBlas Rodriguez Irizar <rodrigblas@gmail.com>2020-09-02 05:57:48 +0200
committerGitHub <noreply@github.com>2020-09-01 20:57:48 -0700
commit5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa (patch)
treec4ca532bc6a9a09c1defa9e4eb9527fd92d9e7d9 /tokio/tests
parent827077409c8a8ef7adb4d05d522fcf6c1949c876 (diff)
sync: watch channel breaking changes (#2806)
Fixes: #2172
Diffstat (limited to 'tokio/tests')
-rw-r--r--tokio/tests/sync_watch.rs52
1 files changed, 26 insertions, 26 deletions
diff --git a/tokio/tests/sync_watch.rs b/tokio/tests/sync_watch.rs
index 2bc5bb2a..5d550443 100644
--- a/tokio/tests/sync_watch.rs
+++ b/tokio/tests/sync_watch.rs
@@ -12,7 +12,7 @@ fn single_rx_recv() {
{
let mut t = spawn(rx.recv());
- let v = assert_ready!(t.poll()).unwrap();
+ let v = assert_ready!(t.poll());
assert_eq!(v, "one");
}
@@ -21,11 +21,11 @@ fn single_rx_recv() {
assert_pending!(t.poll());
- tx.broadcast("two").unwrap();
+ tx.send("two").unwrap();
assert!(t.is_woken());
- let v = assert_ready!(t.poll()).unwrap();
+ let v = assert_ready!(t.poll());
assert_eq!(v, "two");
}
@@ -37,7 +37,7 @@ fn single_rx_recv() {
drop(tx);
let res = assert_ready!(t.poll());
- assert!(res.is_none());
+ assert_eq!(res, "two");
}
}
@@ -51,10 +51,10 @@ fn multi_rx() {
let mut t2 = spawn(rx2.recv());
let res = assert_ready!(t1.poll());
- assert_eq!(res.unwrap(), "one");
+ assert_eq!(res, "one");
let res = assert_ready!(t2.poll());
- assert_eq!(res.unwrap(), "one");
+ assert_eq!(res, "one");
}
let mut t2 = spawn(rx2.recv());
@@ -65,13 +65,13 @@ fn multi_rx() {
assert_pending!(t1.poll());
assert_pending!(t2.poll());
- tx.broadcast("two").unwrap();
+ tx.send("two").unwrap();
assert!(t1.is_woken());
assert!(t2.is_woken());
let res = assert_ready!(t1.poll());
- assert_eq!(res.unwrap(), "two");
+ assert_eq!(res, "two");
}
{
@@ -79,16 +79,16 @@ fn multi_rx() {
assert_pending!(t1.poll());
- tx.broadcast("three").unwrap();
+ tx.send("three").unwrap();
assert!(t1.is_woken());
assert!(t2.is_woken());
let res = assert_ready!(t1.poll());
- assert_eq!(res.unwrap(), "three");
+ assert_eq!(res, "three");
let res = assert_ready!(t2.poll());
- assert_eq!(res.unwrap(), "three");
+ assert_eq!(res, "three");
}
drop(t2);
@@ -100,10 +100,10 @@ fn multi_rx() {
assert_pending!(t1.poll());
assert_pending!(t2.poll());
- tx.broadcast("four").unwrap();
+ tx.send("four").unwrap();
let res = assert_ready!(t1.poll());
- assert_eq!(res.unwrap(), "four");
+ assert_eq!(res, "four");
drop(t1);
let mut t1 = spawn(rx1.recv());
@@ -113,15 +113,15 @@ fn multi_rx() {
assert!(t1.is_woken());
let res = assert_ready!(t1.poll());
- assert!(res.is_none());
+ assert_eq!(res, "four");
let res = assert_ready!(t2.poll());
- assert_eq!(res.unwrap(), "four");
+ assert_eq!(res, "four");
drop(t2);
let mut t2 = spawn(rx2.recv());
let res = assert_ready!(t2.poll());
- assert!(res.is_none());
+ assert_eq!(res, "four");
}
}
@@ -135,44 +135,44 @@ fn rx_observes_final_value() {
{
let mut t1 = spawn(rx.recv());
let res = assert_ready!(t1.poll());
- assert_eq!(res.unwrap(), "one");
+ assert_eq!(res, "one");
}
{
let mut t1 = spawn(rx.recv());
let res = assert_ready!(t1.poll());
- assert!(res.is_none());
+ assert_eq!(res, "one");
}
// Sending a value
let (tx, mut rx) = watch::channel("one");
- tx.broadcast("two").unwrap();
+ tx.send("two").unwrap();
{
let mut t1 = spawn(rx.recv());
let res = assert_ready!(t1.poll());
- assert_eq!(res.unwrap(), "two");
+ assert_eq!(res, "two");
}
{
let mut t1 = spawn(rx.recv());
assert_pending!(t1.poll());
- tx.broadcast("three").unwrap();
+ tx.send("three").unwrap();
drop(tx);
assert!(t1.is_woken());
let res = assert_ready!(t1.poll());
- assert_eq!(res.unwrap(), "three");
+ assert_eq!(res, "three");
}
{
let mut t1 = spawn(rx.recv());
let res = assert_ready!(t1.poll());
- assert!(res.is_none());
+ assert_eq!(res, "three");
}
}
@@ -190,7 +190,7 @@ fn poll_close() {
assert_ready!(t.poll());
}
- assert!(tx.broadcast("two").is_err());
+ assert!(tx.send("two").is_err());
}
#[test]
@@ -210,7 +210,7 @@ fn stream_impl() {
assert_pending!(t.poll());
- tx.broadcast("two").unwrap();
+ tx.send("two").unwrap();
assert!(t.is_woken());
@@ -226,6 +226,6 @@ fn stream_impl() {
drop(tx);
let res = assert_ready!(t.poll());
- assert!(res.is_none());
+ assert_eq!(res, Some("two"));
}
}