id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:16
} } impl ArcWake for SendOnDrop { fn wake_by_ref(_arc_self: &Arc<Self>) {} } // Test if there is no deadlock when replacing the old waker. let (tx, mut rx) = broadcast::channel(16); let mut fut = Box::pin(async { let _ = rx.recv().await; }); // Store our special wake...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400/tokio/tests/sync_broadcast.rs
601
660
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:17
let _ = tx.send(()); } #[tokio::test] async fn receiver_recv_is_cooperative() { let (tx, mut rx) = broadcast::channel(8); tokio::select! { biased; _ = async { loop { assert!(tx.send(()).is_ok()); assert!(rx.recv().await.is_ok()); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400/tokio/tests/sync_broadcast.rs
641
670
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:18
let mut task = task::spawn(tx.closed()); assert_pending!(task.poll()); drop(rx); assert!(!task.is_woken()); assert_pending!(task.poll()); drop(rx2); assert!(task.is_woken()); let rx3 = tx.subscribe(); assert_pending!(task.poll()); drop(rx3); assert!(task.is_woken()); asse...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
193c1574a119605e4d9081d481a6bb03e7bf26cc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/193c1574a119605e4d9081d481a6bb03e7bf26cc/tokio/tests/sync_broadcast.rs
681
708
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:14
#[test] fn resubscribe_to_closed_channel() { let (tx, rx) = tokio::sync::broadcast::channel::<u32>(2); drop(tx); let mut rx_resub = rx.resubscribe(); assert_closed!(rx_resub.try_recv()); } #[test] fn sender_len() { let (tx, mut rx1) = broadcast::channel(4); let mut rx2 = tx.subscribe(); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
4380c3d821e661ee193f11e1cedc8287f354f6fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380c3d821e661ee193f11e1cedc8287f354f6fb/tokio/tests/sync_broadcast.rs
521
580
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:15
assert_eq!(tx.len(), 4); assert!(!tx.is_empty()); } #[test] #[cfg(not(all(target_family = "wasm", not(target_os = "wasi"))))] fn sender_len_random() { use rand::Rng; let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); for _ in 0..1000 { match rand::thread_rng().gen_r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
4380c3d821e661ee193f11e1cedc8287f354f6fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380c3d821e661ee193f11e1cedc8287f354f6fb/tokio/tests/sync_broadcast.rs
561
620
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:16
let _ = self.0.send(()); } } impl ArcWake for SendOnDrop { fn wake_by_ref(_arc_self: &Arc<Self>) {} } // Test if there is no deadlock when replacing the old waker. let (tx, mut rx) = broadcast::channel(16); let mut fut = Box::pin(async { let _ = rx.recv().await; }...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
4380c3d821e661ee193f11e1cedc8287f354f6fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380c3d821e661ee193f11e1cedc8287f354f6fb/tokio/tests/sync_broadcast.rs
601
660
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:17
// Shouldn't deadlock. let _ = tx.send(()); } #[tokio::test] async fn receiver_recv_is_cooperative() { let (tx, mut rx) = broadcast::channel(8); tokio::select! { biased; _ = async { loop { assert!(tx.send(()).is_ok()); assert!(rx.recv().await.is_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
4380c3d821e661ee193f11e1cedc8287f354f6fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380c3d821e661ee193f11e1cedc8287f354f6fb/tokio/tests/sync_broadcast.rs
641
700
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:18
let rx2 = tx.subscribe(); let mut task = task::spawn(tx.closed()); assert_pending!(task.poll()); drop(rx); assert!(!task.is_woken()); assert_pending!(task.poll()); drop(rx2); assert!(task.is_woken()); let rx3 = tx.subscribe(); assert_pending!(task.poll()); drop(rx3); ass...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
4380c3d821e661ee193f11e1cedc8287f354f6fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4380c3d821e661ee193f11e1cedc8287f354f6fb/tokio/tests/sync_broadcast.rs
681
710
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:16
} } impl ArcWake for SendOnDrop { fn wake_by_ref(_arc_self: &Arc<Self>) {} } // Test if there is no deadlock when replacing the old waker. let (tx, mut rx) = broadcast::channel(16); let mut fut = Box::pin(async { let _ = rx.recv().await; }); // Store our special wake...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
5c8cd33820b029ebc8263c461fe03a2cc7f87577
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5c8cd33820b029ebc8263c461fe03a2cc7f87577/tokio/tests/sync_broadcast.rs
601
660
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:17
let _ = tx.send(()); } #[tokio::test] async fn receiver_recv_is_cooperative() { let (tx, mut rx) = broadcast::channel(8); tokio::select! { biased; _ = async { loop { assert!(tx.send(()).is_ok()); assert!(rx.recv().await.is_ok()); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
5c8cd33820b029ebc8263c461fe03a2cc7f87577
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5c8cd33820b029ebc8263c461fe03a2cc7f87577/tokio/tests/sync_broadcast.rs
641
700
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:16
} } impl ArcWake for SendOnDrop { fn wake_by_ref(_arc_self: &Arc<Self>) {} } // Test if there is no deadlock when replacing the old waker. let (tx, mut rx) = broadcast::channel(16); let mut fut = Box::pin(async { let _ = rx.recv().await; }); // Store our special wake...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
21df16d7595880247642c4fb38f1c365a49de75b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/21df16d7595880247642c4fb38f1c365a49de75b/tokio/tests/sync_broadcast.rs
601
658
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:17
let _ = tx.send(()); } #[tokio::test] async fn receiver_recv_is_cooperative() { let (tx, mut rx) = broadcast::channel(8); tokio::select! { biased; _ = async { loop { assert!(tx.send(()).is_ok()); assert!(rx.recv().await.is_ok()); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
21df16d7595880247642c4fb38f1c365a49de75b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/21df16d7595880247642c4fb38f1c365a49de75b/tokio/tests/sync_broadcast.rs
641
658
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:16
} } impl ArcWake for SendOnDrop { fn wake_by_ref(_arc_self: &Arc<Self>) {} } // Test if there is no deadlock when replacing the old waker. let (tx, mut rx) = broadcast::channel(16); let mut fut = Box::pin(async { let _ = rx.recv().await; }); // Store our special wake...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
daa89017dad7cecb769d3145c4368ae491a4ac67
github
async-runtime
https://github.com/tokio-rs/tokio/blob/daa89017dad7cecb769d3145c4368ae491a4ac67/tokio/tests/sync_broadcast.rs
601
642
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_ok!(tx.send("three")); // Lagged too far let x = dbg!(rx2.try_recv()); assert_lagged!(x, 1); // Calling again gets the next value assert_eq!("two", assert_recv!(rx2)); assert_eq!("two", assert_recv!(rx1)); assert_eq!("three", assert_recv!(rx1)); assert_ok!(tx.send("four")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
fn zero_capacity() { broadcast::channel::<()>(0); } #[test] #[should_panic] #[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn capacity_too_big() { use std::usize; broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] #[cfg(panic = "unwind")] #[cfg(not(target_family =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:9
let val = assert_recv!(rx); assert_eq!(val, MyVal(1)); } #[test] fn dropping_tx_notifies_rx() { let (tx, mut rx1) = broadcast::channel::<()>(16); let mut rx2 = tx.subscribe(); let tx2 = tx.clone(); let mut recv1 = task::spawn(rx1.recv()); let mut recv2 = task::spawn(rx2.recv()); assert_p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
321
380
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:10
assert_ok!(tx.send(msg.clone())); assert_eq!(2, Arc::strong_count(&msg)); drop(rx); assert_eq!(1, Arc::strong_count(&msg)); } #[test] fn single_capacity_recvs() { let (tx, mut rx) = broadcast::channel(1); assert_ok!(tx.send(1)); assert_eq!(assert_recv!(rx), 1); assert_empty!(rx); } #[...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
361
420
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:11
assert_closed!(rx.try_recv()); } #[test] fn dropping_sender_does_not_overwrite() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); drop(tx); assert_eq!(assert_recv!(rx), 1); assert_eq!(assert_recv!(rx), 2); assert_closed!(rx.try_recv()); } #[test...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
401
460
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:12
assert_lagged!(rx.try_recv(), 2); assert_eq!(assert_recv!(rx), 3); assert_eq!(assert_recv!(rx), 4); assert_closed!(rx.try_recv()); } #[test] fn lagging_receiver_recovers_after_wrap_open() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); assert_ok!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
441
500
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:13
fn is_closed(err: broadcast::error::RecvError) -> bool { matches!(err, broadcast::error::RecvError::Closed) } #[test] fn resubscribe_points_to_tail() { let (tx, mut rx) = broadcast::channel(3); tx.send(1).unwrap(); let mut rx_resub = rx.resubscribe(); // verify we're one behind at the start a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
481
540
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:14
} #[test] fn resubscribe_to_closed_channel() { let (tx, rx) = tokio::sync::broadcast::channel::<u32>(2); drop(tx); let mut rx_resub = rx.resubscribe(); assert_closed!(rx_resub.try_recv()); } #[test] fn sender_len() { let (tx, mut rx1) = broadcast::channel(4); let mut rx2 = tx.subscribe(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
521
580
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:15
assert_eq!(tx.len(), 4); assert!(!tx.is_empty()); } #[test] #[cfg(not(all(target_family = "wasm", not(target_os = "wasi"))))] fn sender_len_random() { use rand::Rng; let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); for _ in 0..1000 { match rand::thread_rng().gen_r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
561
620
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:16
fn drop(&mut self) { let _ = self.0.send(()); } } impl ArcWake for SendOnDrop { fn wake_by_ref(_arc_self: &Arc<Self>) {} } // Test if there is no deadlock when replacing the old waker. let (tx, mut rx) = broadcast::channel(16); let mut fut = Box::pin(async { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_broadcast.rs
601
644
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, ass...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
_ => panic!("did not lag"), } }; } macro_rules! assert_closed { ($e:expr) => { match assert_err!($e) { broadcast::error::TryRecvError::Closed => {} _ => panic!("is not closed"), } }; } trait AssertSend: Send + Sync {} impl AssertSend for broadcast::Sender<i3...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:3
let n = assert_ok!(tx.send("hello")); assert_eq!(n, 2); let val = assert_recv!(rx1); assert_eq!(val, "hello"); let val = assert_recv!(rx2); assert_eq!(val, "hello"); assert_empty!(rx1); assert_empty!(rx2); } #[test] fn send_recv_bounded() { let (tx, mut rx) = broadcast::channel(16); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_broadcast.rs
81
140
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:4
assert_ok!(tx.send("hello")); assert!(recv1.is_woken()); assert!(recv2.is_woken()); let val1 = assert_ready_ok!(recv1.poll()); let val2 = assert_ready_ok!(recv2.poll()); assert_eq!(val1, "hello"); assert_eq!(val2, "hello"); drop((recv1, recv2)); let mut recv1 = task::spawn(rx1.recv()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:6
let val = assert_ready_ok!(recv1.poll()); assert_eq!(val, "three"); let val = assert_ready_ok!(recv2.poll()); assert_eq!(val, "one"); } let val = assert_recv!(rx2); assert_eq!(val, "two"); let val = assert_recv!(rx2); assert_eq!(val, "three"); } #[test] fn drop_rx_while_v...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_broadcast.rs
201
260
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_ok!(tx.send("three")); // Lagged too far let x = dbg!(rx2.try_recv()); assert_lagged!(x, 1); // Calling again gets the next value assert_eq!("two", assert_recv!(rx2)); assert_eq!("two", assert_recv!(rx1)); assert_eq!("three", assert_recv!(rx1)); assert_ok!(tx.send("four")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
broadcast::channel::<()>(0); } #[test] #[should_panic] #[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn capacity_too_big() { use std::usize; broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] #[cfg(panic = "unwind")] #[cfg(not(target_family = "wasm"))] // wasm curren...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:16
let _ = self.0.send(()); } } impl ArcWake for SendOnDrop { fn wake_by_ref(_arc_self: &Arc<Self>) {} } // Test if there is no deadlock when replacing the old waker. let (tx, mut rx) = broadcast::channel(16); let mut fut = Box::pin(async { let _ = rx.recv().await; }...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_broadcast.rs
601
643
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, asse...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8497f379b5c57d37db82db5dd74833998ae847a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8497f379b5c57d37db82db5dd74833998ae847a1/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_ok!(tx.send("three")); // Lagged too far let x = dbg!(rx2.try_recv()); assert_lagged!(x, 1); // Calling again gets the next value assert_eq!("two", assert_recv!(rx2)); assert_eq!("two", assert_recv!(rx1)); assert_eq!("three", assert_recv!(rx1)); assert_ok!(tx.send("four")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8497f379b5c57d37db82db5dd74833998ae847a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8497f379b5c57d37db82db5dd74833998ae847a1/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
broadcast::channel::<()>(0); } #[test] #[should_panic] #[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding fn capacity_too_big() { use std::usize; broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] #[cfg(panic = "unwind")] #[cfg(not(tokio_wasm))] // wasm currently doesn't support unwi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8497f379b5c57d37db82db5dd74833998ae847a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8497f379b5c57d37db82db5dd74833998ae847a1/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:14
#[test] fn resubscribe_to_closed_channel() { let (tx, rx) = tokio::sync::broadcast::channel::<u32>(2); drop(tx); let mut rx_resub = rx.resubscribe(); assert_closed!(rx_resub.try_recv()); } #[test] fn sender_len() { let (tx, mut rx1) = broadcast::channel(4); let mut rx2 = tx.subscribe(); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8497f379b5c57d37db82db5dd74833998ae847a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8497f379b5c57d37db82db5dd74833998ae847a1/tokio/tests/sync_broadcast.rs
521
580
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:15
assert_eq!(tx.len(), 4); assert!(!tx.is_empty()); } #[test] #[cfg(not(tokio_wasm_not_wasi))] fn sender_len_random() { use rand::Rng; let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); for _ in 0..1000 { match rand::thread_rng().gen_range(0..4) { 0 => { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8497f379b5c57d37db82db5dd74833998ae847a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8497f379b5c57d37db82db5dd74833998ae847a1/tokio/tests/sync_broadcast.rs
561
620
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:15
assert_eq!(tx.len(), 4); assert!(!tx.is_empty()); } #[test] #[cfg(not(tokio_wasm_not_wasi))] fn sender_len_random() { use rand::Rng; let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); for _ in 0..1000 { match rand::thread_rng().gen_range(0..4) { 0 => { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c90757f07a1b15d7e26a710003d8e98a83db1ffc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c90757f07a1b15d7e26a710003d8e98a83db1ffc/tokio/tests/sync_broadcast.rs
561
589
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_ok!(tx.send("three")); // Lagged too far let x = dbg!(rx2.try_recv()); assert_lagged!(x, 1); // Calling again gets the next value assert_eq!("two", assert_recv!(rx2)); assert_eq!("two", assert_recv!(rx1)); assert_eq!("three", assert_recv!(rx1)); assert_ok!(tx.send("four")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c390a62387fe7346951c8bc57ea2761614b83e82
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c390a62387fe7346951c8bc57ea2761614b83e82/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
broadcast::channel::<()>(0); } #[test] #[should_panic] #[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding fn capacity_too_big() { use std::usize; broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] #[cfg(not(tokio_wasm))] // wasm currently doesn't support unwinding fn panic_in_clone()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c390a62387fe7346951c8bc57ea2761614b83e82
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c390a62387fe7346951c8bc57ea2761614b83e82/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:14
#[test] fn resubscribe_to_closed_channel() { let (tx, rx) = tokio::sync::broadcast::channel::<u32>(2); drop(tx); let mut rx_resub = rx.resubscribe(); assert_closed!(rx_resub.try_recv()); } #[test] fn sender_len() { let (tx, mut rx1) = broadcast::channel(4); let mut rx2 = tx.subscribe(); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c390a62387fe7346951c8bc57ea2761614b83e82
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c390a62387fe7346951c8bc57ea2761614b83e82/tokio/tests/sync_broadcast.rs
521
580
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:15
assert!(!tx.is_empty()); } #[test] #[cfg(not(tokio_wasm_not_wasi))] fn sender_len_random() { use rand::Rng; let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); for _ in 0..1000 { match rand::thread_rng().gen_range(0..4) { 0 => { let _ = rx1.tr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c390a62387fe7346951c8bc57ea2761614b83e82
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c390a62387fe7346951c8bc57ea2761614b83e82/tokio/tests/sync_broadcast.rs
561
588
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:13
} #[test] fn resubscribe_points_to_tail() { let (tx, mut rx) = broadcast::channel(3); tx.send(1).unwrap(); let mut rx_resub = rx.resubscribe(); // verify we're one behind at the start assert_empty!(rx_resub); assert_eq!(assert_recv!(rx), 1); // verify we do not affect rx tx.send(2).u...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
9d9488db67136651f85d839efcb5f61aba8531c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9d9488db67136651f85d839efcb5f61aba8531c9/tokio/tests/sync_broadcast.rs
481
528
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, asse...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
_ => panic!("did not lag"), } }; } macro_rules! assert_closed { ($e:expr) => { match assert_err!($e) { broadcast::error::TryRecvError::Closed => {} _ => panic!("did not lag"), } }; } trait AssertSend: Send + Sync {} impl AssertSend for broadcast::Sender<i32>...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:13
} #[test] fn resubscribe_points_to_tail() { let (tx, mut rx) = broadcast::channel(3); tx.send(1).unwrap(); let mut rx_resub = rx.resubscribe(); // verify we're one behind at the start assert_empty!(rx_resub); assert_eq!(assert_recv!(rx), 1); // verify we do not affect rx tx.send(2).u...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_broadcast.rs
481
519
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, ass...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_ok!(tx.send("three")); // Lagged too far let x = dbg!(rx2.try_recv()); assert_lagged!(x, 1); // Calling again gets the next value assert_eq!("two", assert_recv!(rx2)); assert_eq!("two", assert_recv!(rx1)); assert_eq!("three", assert_recv!(rx1)); assert_ok!(tx.send("four")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
broadcast::channel::<()>(0); } #[test] #[should_panic] #[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn capacity_too_big() { use std::usize; broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] #[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwin...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, ass...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_ok!(tx.send("three")); // Lagged too far let x = dbg!(rx2.try_recv()); assert_lagged!(x, 1); // Calling again gets the next value assert_eq!("two", assert_recv!(rx2)); assert_eq!("two", assert_recv!(rx1)); assert_eq!("three", assert_recv!(rx1)); assert_ok!(tx.send("four")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
broadcast::channel::<()>(0); } #[test] #[should_panic] #[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwinding fn capacity_too_big() { use std::usize; broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] #[cfg(not(target_arch = "wasm32"))] // wasm currently doesn't support unwin...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
f6c0405084cc7efbbf10202d44aaf8885fd3f84f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f6c0405084cc7efbbf10202d44aaf8885fd3f84f/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:12
assert_eq!(assert_recv!(rx), 3); assert_eq!(assert_recv!(rx), 4); assert_closed!(rx.try_recv()); } #[test] fn lagging_receiver_recovers_after_wrap_open() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); assert_ok!(tx.send(3)); assert_lagged!(rx.t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
2f944dfa1be67411f54f625674fb8f5f14927825
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2f944dfa1be67411f54f625674fb8f5f14927825/tokio/tests/sync_broadcast.rs
441
481
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:11
#[test] fn dropping_sender_does_not_overwrite() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); drop(tx); assert_eq!(assert_recv!(rx), 1); assert_eq!(assert_recv!(rx), 2); assert_closed!(rx.try_recv()); } #[test] fn lagging_receiver_recovers_aft...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_broadcast.rs
401
460
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:12
assert_eq!(assert_recv!(rx), 3); assert_eq!(assert_recv!(rx), 4); assert_closed!(rx.try_recv()); } #[test] fn lagging_receiver_recovers_after_wrap_open() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); assert_ok!(tx.send(3)); assert_lagged!(rx.t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_broadcast.rs
441
462
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::sync::Arc; macro_rules! assert_recv { ($e:expr) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
} macro_rules! assert_closed { ($e:expr) => { match assert_err!($e) { broadcast::error::TryRecvError::Closed => {} _ => panic!("did not lag"), } }; } trait AssertSend: Send + Sync {} impl AssertSend for broadcast::Sender<i32> {} impl AssertSend for broadcast::Receiver<i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:3
let val = assert_recv!(rx1); assert_eq!(val, "hello"); let val = assert_recv!(rx2); assert_eq!(val, "hello"); assert_empty!(rx1); assert_empty!(rx2); } #[test] fn send_recv_bounded() { let (tx, mut rx) = broadcast::channel(16); let mut recv = task::spawn(rx.recv()); assert_pending!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
81
140
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:4
assert!(recv2.is_woken()); let val1 = assert_ready_ok!(recv1.poll()); let val2 = assert_ready_ok!(recv2.poll()); assert_eq!(val1, "hello"); assert_eq!(val2, "hello"); drop((recv1, recv2)); let mut recv1 = task::spawn(rx1.recv()); let mut recv2 = task::spawn(rx2.recv()); assert_pendin...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:5
} #[test] fn send_slow_rx() { let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); { let mut recv2 = task::spawn(rx2.recv()); { let mut recv1 = task::spawn(rx1.recv()); assert_pending!(recv1.poll()); assert_pending!(recv2.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
161
220
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:6
let val = assert_ready_ok!(recv2.poll()); assert_eq!(val, "one"); } let val = assert_recv!(rx2); assert_eq!(val, "two"); let val = assert_recv!(rx2); assert_eq!(val, "three"); } #[test] fn drop_rx_while_values_remain() { let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
201
260
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
let x = dbg!(rx2.try_recv()); assert_lagged!(x, 1); // Calling again gets the next value assert_eq!("two", assert_recv!(rx2)); assert_eq!("two", assert_recv!(rx1)); assert_eq!("three", assert_recv!(rx1)); assert_ok!(tx.send("four")); assert_ok!(tx.send("five")); assert_lagged!(rx2.tr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
#[should_panic] fn capacity_too_big() { use std::usize; broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] fn panic_in_clone() { use std::panic::{self, AssertUnwindSafe}; #[derive(Eq, PartialEq, Debug)] struct MyVal(usize); impl Clone for MyVal { fn clone(&self) -> MyVal { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:9
let tx2 = tx.clone(); let mut recv1 = task::spawn(rx1.recv()); let mut recv2 = task::spawn(rx2.recv()); assert_pending!(recv1.poll()); assert_pending!(recv2.poll()); drop(tx); assert_pending!(recv1.poll()); assert_pending!(recv2.poll()); drop(tx2); assert!(recv1.is_woken()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
321
380
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:10
#[test] fn single_capacity_recvs() { let (tx, mut rx) = broadcast::channel(1); assert_ok!(tx.send(1)); assert_eq!(assert_recv!(rx), 1); assert_empty!(rx); } #[test] fn single_capacity_recvs_after_drop_1() { let (tx, mut rx) = broadcast::channel(1); assert_ok!(tx.send(1)); drop(tx); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
361
420
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:11
assert_ok!(tx.send(2)); drop(tx); assert_eq!(assert_recv!(rx), 1); assert_eq!(assert_recv!(rx), 2); assert_closed!(rx.try_recv()); } #[test] fn lagging_receiver_recovers_after_wrap_closed_1() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
401
456
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:12
fn lagging_receiver_recovers_after_wrap_open() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); assert_ok!(tx.send(3)); assert_lagged!(rx.try_recv(), 1); assert_eq!(assert_recv!(rx), 2); assert_eq!(assert_recv!(rx), 3); assert_empty!(rx); } f...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/sync_broadcast.rs
441
456
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
} macro_rules! assert_closed { ($e:expr) => { match assert_err!($e) { broadcast::error::TryRecvError::Closed => {} _ => panic!("did not lag"), } }; } trait AssertSend: Send + Sync {} impl AssertSend for broadcast::Sender<i32> {} impl AssertSend for broadcast::Receiver<i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
2e05399f4b6be41680036cc158348973689840ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e05399f4b6be41680036cc158348973689840ca/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:3
let val = assert_recv!(rx1); assert_eq!(val, "hello"); let val = assert_recv!(rx2); assert_eq!(val, "hello"); assert_empty!(rx1); assert_empty!(rx2); } #[tokio::test] async fn send_recv_into_stream_ready() { use tokio::stream::StreamExt; let (tx, rx) = broadcast::channel::<i32>(8); t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
2e05399f4b6be41680036cc158348973689840ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e05399f4b6be41680036cc158348973689840ca/tokio/tests/sync_broadcast.rs
81
140
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:4
let mut recv = task::spawn(rx.next()); assert_pending!(recv.poll()); assert_ok!(tx.send(1)); assert!(recv.is_woken()); let val = assert_ready!(recv.poll()); assert_eq!(val, Some(Ok(1))); } #[test] fn send_recv_bounded() { let (tx, mut rx) = broadcast::channel(16); let mut recv = task::sp...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
2e05399f4b6be41680036cc158348973689840ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2e05399f4b6be41680036cc158348973689840ca/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::sync::Arc; macro_rules! assert_recv { ($e:expr) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
b704c53b9cc76eaf8c9c6585f8444c4515d27728
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
} macro_rules! assert_closed { ($e:expr) => { match assert_err!($e) { broadcast::TryRecvError::Closed => {} _ => panic!("did not lag"), } }; } trait AssertSend: Send + Sync {} impl AssertSend for broadcast::Sender<i32> {} impl AssertSend for broadcast::Receiver<i32> {} ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
b704c53b9cc76eaf8c9c6585f8444c4515d27728
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:12
assert_ok!(tx.send(2)); drop(tx); assert_eq!(assert_recv!(rx), 1); assert_eq!(assert_recv!(rx), 2); assert_closed!(rx.try_recv()); } #[test] fn lagging_receiver_recovers_after_wrap_closed_1() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
b704c53b9cc76eaf8c9c6585f8444c4515d27728
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/sync_broadcast.rs
441
496
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:13
fn lagging_receiver_recovers_after_wrap_open() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); assert_ok!(tx.send(3)); assert_lagged!(rx.try_recv(), 1); assert_eq!(assert_recv!(rx), 2); assert_eq!(assert_recv!(rx), 3); assert_empty!(rx); } f...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
b704c53b9cc76eaf8c9c6585f8444c4515d27728
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b704c53b9cc76eaf8c9c6585f8444c4515d27728/tokio/tests/sync_broadcast.rs
481
496
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:12
assert_ok!(tx.send(2)); drop(tx); assert_eq!(assert_recv!(rx), 1); assert_eq!(assert_recv!(rx), 2); assert_closed!(rx.try_recv()); } #[test] fn lagging_receiver_recovers_after_wrap_closed_1() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
242ea011891099f348b755b2ea10ec9e9ea104db
github
async-runtime
https://github.com/tokio-rs/tokio/blob/242ea011891099f348b755b2ea10ec9e9ea104db/tokio/tests/sync_broadcast.rs
441
499
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:13
fn lagging_receiver_recovers_after_wrap_open() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); assert_ok!(tx.send(3)); assert_lagged!(rx.try_recv(), 1); assert_eq!(assert_recv!(rx), 2); assert_eq!(assert_recv!(rx), 3); assert_empty!(rx); } f...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
242ea011891099f348b755b2ea10ec9e9ea104db
github
async-runtime
https://github.com/tokio-rs/tokio/blob/242ea011891099f348b755b2ea10ec9e9ea104db/tokio/tests/sync_broadcast.rs
481
499
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:12
assert_ok!(tx.send(2)); drop(tx); assert_eq!(assert_recv!(rx), 1); assert_eq!(assert_recv!(rx), 2); assert_closed!(rx.try_recv()); } #[test] fn lagging_receiver_recovers_after_wrap_closed_1() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
fb7dfcf4322b5e60604815aea91266b88f0b7823
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fb7dfcf4322b5e60604815aea91266b88f0b7823/tokio/tests/sync_broadcast.rs
441
500
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:13
fn lagging_receiver_recovers_after_wrap_open() { let (tx, mut rx) = broadcast::channel(2); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); assert_ok!(tx.send(3)); assert_lagged!(rx.try_recv(), 1); assert_eq!(assert_recv!(rx), 2); assert_eq!(assert_recv!(rx), 3); assert_empty!(rx); } #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
fb7dfcf4322b5e60604815aea91266b88f0b7823
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fb7dfcf4322b5e60604815aea91266b88f0b7823/tokio/tests/sync_broadcast.rs
481
532
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:14
assert!(recv.is_woken()); let val = assert_ready!(recv.poll()); assert_eq!(val, Some(Ok(1))); } fn is_closed(err: broadcast::RecvError) -> bool { match err { broadcast::RecvError::Closed => true, _ => false, } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
fb7dfcf4322b5e60604815aea91266b88f0b7823
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fb7dfcf4322b5e60604815aea91266b88f0b7823/tokio/tests/sync_broadcast.rs
521
532
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
} macro_rules! assert_closed { ($e:expr) => { match assert_err!($e) { broadcast::TryRecvError::Closed => {} _ => panic!("did not lag"), } }; } trait AssertSend: Send + Sync {} impl AssertSend for broadcast::Sender<i32> {} impl AssertSend for broadcast::Receiver<i32> {} ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
cc8a6625982b5fc0694d05b4e9fb7d6a592702a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc8a6625982b5fc0694d05b4e9fb7d6a592702a1/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:3
let val = assert_recv!(rx1); assert_eq!(val, "hello"); let val = assert_recv!(rx2); assert_eq!(val, "hello"); assert_empty!(rx1); assert_empty!(rx2); } #[tokio::test] async fn send_recv_stream() { use tokio::stream::StreamExt; let (tx, mut rx) = broadcast::channel::<i32>(8); assert_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
cc8a6625982b5fc0694d05b4e9fb7d6a592702a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc8a6625982b5fc0694d05b4e9fb7d6a592702a1/tokio/tests/sync_broadcast.rs
81
140
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:4
assert_eq!(val, "hello"); } #[test] fn send_two_recv_bounded() { let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); let mut recv1 = task::spawn(rx1.recv()); let mut recv2 = task::spawn(rx2.recv()); assert_pending!(recv1.poll()); assert_pending!(recv2.poll()); asser...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
cc8a6625982b5fc0694d05b4e9fb7d6a592702a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc8a6625982b5fc0694d05b4e9fb7d6a592702a1/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::sync::Arc; macro_rules! assert_recv { ($e:expr) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a81958484941ddcc2f1955fb6873c827f694ec9b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a81958484941ddcc2f1955fb6873c827f694ec9b/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
} macro_rules! assert_closed { ($e:expr) => { match assert_err!($e) { broadcast::TryRecvError::Closed => {} _ => panic!("did not lag"), } }; } trait AssertSend: Send {} impl AssertSend for broadcast::Sender<i32> {} impl AssertSend for broadcast::Receiver<i32> {} #[test...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a81958484941ddcc2f1955fb6873c827f694ec9b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a81958484941ddcc2f1955fb6873c827f694ec9b/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] use tokio::sync::broadcast; use tokio_test::task; use tokio_test::{ assert_err, assert_ok, assert_pending, assert_ready, assert_ready_err, assert_ready_ok, }; use std::sync::Arc; macro_rules! assert_recv { ($e:expr) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
1
60
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
} trait AssertSend: Send {} impl AssertSend for broadcast::Sender<i32> {} impl AssertSend for broadcast::Receiver<i32> {} #[test] fn send_try_recv_bounded() { let (tx, mut rx) = broadcast::channel(16); assert_empty!(rx); let n = assert_ok!(tx.send("hello")); assert_eq!(n, 1); let val = assert_r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:3
} #[tokio::test] async fn send_recv_stream() { use tokio::stream::StreamExt; let (tx, mut rx) = broadcast::channel::<i32>(8); assert_ok!(tx.send(1)); assert_ok!(tx.send(2)); assert_eq!(Some(Ok(1)), rx.next().await); assert_eq!(Some(Ok(2)), rx.next().await); drop(tx); assert_eq!(Non...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
81
140
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:4
let mut recv2 = task::spawn(rx2.recv()); assert_pending!(recv1.poll()); assert_pending!(recv2.poll()); assert_ok!(tx.send("hello")); assert!(recv1.is_woken()); assert!(recv2.is_woken()); let val1 = assert_ready_ok!(recv1.poll()); let val2 = assert_ready_ok!(recv2.poll()); assert_eq!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:5
{ let mut recv1 = task::spawn(rx1.recv()); assert_pending!(recv1.poll()); assert_pending!(recv2.poll()); assert_ok!(tx.send("one")); assert!(recv1.is_woken()); assert!(recv2.is_woken()); assert_ok!(tx.send("two")); let ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
161
220
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:6
assert_eq!(val, "three"); } #[test] fn drop_rx_while_values_remain() { let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); assert_ok!(tx.send("one")); assert_ok!(tx.send("two")); assert_recv!(rx1); assert_recv!(rx2); drop(rx2); drop(rx1); } #[test] fn lagging_r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
201
260
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_ok!(tx.send("five")); assert_lagged!(rx2.try_recv(), 1); assert_ok!(tx.send("six")); assert_lagged!(rx2.try_recv(), 1); } #[test] fn send_no_rx() { let (tx, _) = broadcast::channel(16); assert_err!(tx.send("hello")); let mut rx = tx.subscribe(); assert_ok!(tx.send("world")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
#[derive(Eq, PartialEq, Debug)] struct MyVal(usize); impl Clone for MyVal { fn clone(&self) -> MyVal { assert_ne!(0, self.0); MyVal(self.0) } } let (tx, mut rx) = broadcast::channel(16); assert_ok!(tx.send(MyVal(0))); assert_ok!(tx.send(MyVal(1))); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:9
assert_pending!(recv1.poll()); assert_pending!(recv2.poll()); drop(tx2); assert!(recv1.is_woken()); assert!(recv2.is_woken()); let err = assert_ready_err!(recv1.poll()); assert!(is_closed(err)); let err = assert_ready_err!(recv2.poll()); assert!(is_closed(err)); } #[test] fn unconsu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
a8540948254ec69c630bacd0b4a58a20d701b7ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/tests/sync_broadcast.rs
321
357
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:2
} trait AssertSend: Send {} impl AssertSend for broadcast::Sender<i32> {} impl AssertSend for broadcast::Receiver<i32> {} #[test] fn send_try_recv_bounded() { let (tx, mut rx) = broadcast::channel(16); assert_empty!(rx); let n = assert_ok!(tx.send("hello")); assert_eq!(n, 1); let val = assert_r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:3
} #[test] fn send_recv_bounded() { let (tx, mut rx) = broadcast::channel(16); let mut recv = task::spawn(rx.recv()); assert_pending!(recv.poll()); assert_ok!(tx.send("hello")); assert!(recv.is_woken()); let val = assert_ready_ok!(recv.poll()); assert_eq!(val, "hello"); } #[test] fn sen...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/tests/sync_broadcast.rs
81
140
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:4
let mut recv1 = task::spawn(rx1.recv()); let mut recv2 = task::spawn(rx2.recv()); assert_pending!(recv1.poll()); assert_ok!(tx.send("world")); assert!(recv1.is_woken()); assert!(!recv2.is_woken()); let val1 = assert_ready_ok!(recv1.poll()); let val2 = assert_ready_ok!(recv2.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:5
let val = assert_ready_ok!(task::spawn(rx1.recv()).poll()); assert_eq!(val, "two"); let mut recv1 = task::spawn(rx1.recv()); assert_pending!(recv1.poll()); assert_ok!(tx.send("three")); assert!(recv1.is_woken()); let val = assert_ready_ok!(recv1.poll()); asse...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/tests/sync_broadcast.rs
161
220
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:6
#[test] fn lagging_rx() { let (tx, mut rx1) = broadcast::channel(2); let mut rx2 = tx.subscribe(); assert_ok!(tx.send("one")); assert_ok!(tx.send("two")); assert_eq!("one", assert_recv!(rx1)); assert_ok!(tx.send("three")); // Lagged too far assert_lagged!(rx2.try_recv(), 1); // ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/tests/sync_broadcast.rs
201
260
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_ok!(tx.send("world")); let val = assert_recv!(rx); assert_eq!("world", val); } #[test] #[should_panic] fn zero_capacity() { broadcast::channel::<()>(0); } #[test] #[should_panic] fn capacity_too_big() { use std::usize; broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] fn panic_i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
let _ = rx.try_recv(); })); assert_err!(res); let val = assert_recv!(rx); assert_eq!(val, MyVal(1)); } #[test] fn dropping_tx_notifies_rx() { let (tx, mut rx1) = broadcast::channel::<()>(16); let mut rx2 = tx.subscribe(); let tx2 = tx.clone(); let mut recv1 = task::spawn(rx1.recv())...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c/tokio/tests/sync_broadcast.rs
281
340