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/stream_timeout.rs:2
assert_pending!(stream.poll_next()); time::advance(ms(100)).await; assert_ready_eq!(stream.poll_next(), Some(Ok(2))); // Third item is ready immediately assert_ready_eq!(stream.poll_next(), Some(Ok(3))); // Fourth item is delayed 200ms, times out after 100ms assert_pending!(stream.poll_next()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/stream_timeout.rs
MIT
60d81bbe10faf344ea18438a1c5ecb9173e6ec52
github
async-runtime
https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/tests/stream_timeout.rs
41
100
tokio-rs/tokio:tokio/tests/stream_timeout.rs:3
time::advance(ms(50)).await; let v = assert_ready!(stream.poll_next()); assert!(v.unwrap().is_err()); // timeout! // deadline elapses again, but no error is returned time::advance(ms(50)).await; assert_pending!(stream.poll_next()); time::advance(ms(100)).await; assert_ready_eq!(stream.poll...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/stream_timeout.rs
MIT
60d81bbe10faf344ea18438a1c5ecb9173e6ec52
github
async-runtime
https://github.com/tokio-rs/tokio/blob/60d81bbe10faf344ea18438a1c5ecb9173e6ec52/tokio/tests/stream_timeout.rs
81
109
tokio-rs/tokio:tokio/tests/stream_timeout.rs:1
#![cfg(feature = "full")] use tokio::stream::{self, StreamExt}; use tokio::time::{self, sleep, Duration}; use tokio_test::*; use futures::StreamExt as _; async fn maybe_delay(idx: i32) -> i32 { if idx % 2 == 0 { sleep(ms(200)).await; } idx } fn ms(n: u64) -> Duration { Duration::from_millis(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/stream_timeout.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/stream_timeout.rs
1
60
tokio-rs/tokio:tokio/tests/stream_timeout.rs:2
assert_pending!(stream.poll_next()); time::advance(ms(100)).await; assert_ready_eq!(stream.poll_next(), Some(Ok(2))); // Third item is ready immediately assert_ready_eq!(stream.poll_next(), Some(Ok(3))); // Fourth item is delayed 200ms, times out after 100ms assert_pending!(stream.poll_next()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/stream_timeout.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/stream_timeout.rs
41
100
tokio-rs/tokio:tokio/tests/stream_timeout.rs:3
time::advance(ms(50)).await; let v = assert_ready!(stream.poll_next()); assert!(v.unwrap().is_err()); // timeout! // deadline elapses again, but no error is returned time::advance(ms(50)).await; assert_pending!(stream.poll_next()); time::advance(ms(100)).await; assert_ready_eq!(stream.poll...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/stream_timeout.rs
MIT
53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/stream_timeout.rs
81
109
tokio-rs/tokio:tokio/tests/stream_timeout.rs:1
#![cfg(feature = "full")] use tokio::stream::{self, StreamExt}; use tokio::time::{self, delay_for, Duration}; use tokio_test::*; use futures::StreamExt as _; async fn maybe_delay(idx: i32) -> i32 { if idx % 2 == 0 { delay_for(ms(200)).await; } idx } fn ms(n: u64) -> Duration { Duration::from...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/stream_timeout.rs
MIT
12be90e3fff4041ea6398fc8cd834c3ec173bce5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12be90e3fff4041ea6398fc8cd834c3ec173bce5/tokio/tests/stream_timeout.rs
1
60
tokio-rs/tokio:tokio/tests/support/io_uring.rs:1
#![cfg(all( tokio_unstable, feature = "io-uring", feature = "rt", feature = "fs", target_os = "linux" ))] use io_uring::IoUring; // Currently, we are running some of the tests on Kernels where io_uring is not supported // to check if the fallback mechanism works, this comes with the limitation tha...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/io_uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/support/io_uring.rs
1
24
tokio-rs/tokio:tokio/tests/support/io_vec.rs:1
use std::io::IoSlice; use std::ops::Deref; use std::slice; pub struct IoBufs<'a, 'b>(&'b mut [IoSlice<'a>]); impl<'a, 'b> IoBufs<'a, 'b> { pub fn new(slices: &'b mut [IoSlice<'a>]) -> Self { IoBufs(slices) } pub fn is_empty(&self) -> bool { self.0.is_empty() } pub fn advance(mut ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/io_vec.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/support/io_vec.rs
1
45
tokio-rs/tokio:tokio/tests/support/leaked_buffers.rs:1
/// Can create buffers of arbitrary lifetime. /// Frees created buffers when dropped. /// /// This struct is of course unsafe and the fact that /// it must outlive the created slices has to be ensured by /// the programmer. /// /// Used at certain test scenarios as a safer version of /// Vec::leak, to satisfy the addre...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/leaked_buffers.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/support/leaked_buffers.rs
1
26
tokio-rs/tokio:tokio/tests/support/leaked_buffers.rs:1
/// Can create buffers of arbitrary lifetime. /// Frees created buffers when dropped. /// /// This struct is of course unsafe and the fact that /// it must outlive the created slices has to be ensured by /// the programmer. /// /// Used at certain test scenarios as a safer version of /// Vec::leak, to satisfy the addre...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/leaked_buffers.rs
MIT
454ac1c54fa992004787c109e61bf232697d3652
github
async-runtime
https://github.com/tokio-rs/tokio/blob/454ac1c54fa992004787c109e61bf232697d3652/tokio/tests/support/leaked_buffers.rs
1
26
tokio-rs/tokio:tokio/tests/support/mock_file.rs:1
#![allow(clippy::unnecessary_operation)] use std::collections::VecDeque; use std::fmt; use std::fs::{Metadata, Permissions}; use std::io; use std::io::prelude::*; use std::io::SeekFrom; use std::path::PathBuf; use std::sync::{Arc, Mutex}; pub struct File { shared: Arc<Mutex<Shared>>, } pub struct Handle { sh...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/tests/support/mock_file.rs
1
60
tokio-rs/tokio:tokio/tests/support/mock_file.rs:2
pub fn read_err(&self) -> &Self { let mut s = self.shared.lock().unwrap(); s.calls .push_back(Call::Read(Err(io::ErrorKind::Other.into()))); self } pub fn write(&self, data: &[u8]) -> &Self { let mut s = self.shared.lock().unwrap(); s.calls.push_back(Call::Wr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/tests/support/mock_file.rs
41
100
tokio-rs/tokio:tokio/tests/support/mock_file.rs:3
pub fn sync_all_err(&self) -> &Self { let mut s = self.shared.lock().unwrap(); s.calls .push_back(Call::SyncAll(Err(io::ErrorKind::Other.into()))); self } pub fn sync_data(&self) -> &Self { let mut s = self.shared.lock().unwrap(); s.calls.push_back(Call::Sync...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/tests/support/mock_file.rs
81
140
tokio-rs/tokio:tokio/tests/support/mock_file.rs:4
fn drop(&mut self) { if !std::thread::panicking() { let s = self.shared.lock().unwrap(); assert_eq!(0, s.calls.len()); } } } impl File { pub fn open(_: PathBuf) -> io::Result<File> { unimplemented!(); } pub fn create(_: PathBuf) -> io::Result<File> { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/tests/support/mock_file.rs
121
180
tokio-rs/tokio:tokio/tests/support/mock_file.rs:5
} pub fn sync_data(&self) -> io::Result<()> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(SyncData(ret)) => ret, Some(op) => panic!("expected next call to be {:?}; was sync_all", op), None => panic!("did ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/tests/support/mock_file.rs
161
220
tokio-rs/tokio:tokio/tests/support/mock_file.rs:6
} impl Read for &'_ File { fn read(&mut self, dst: &mut [u8]) -> io::Result<usize> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(Read(Ok(data))) => { assert!(dst.len() >= data.len()); assert!(dst....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/tests/support/mock_file.rs
201
260
tokio-rs/tokio:tokio/tests/support/mock_file.rs:7
fn flush(&mut self) -> io::Result<()> { Ok(()) } } impl Seek for &'_ File { fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(Seek(expect, res)) => { a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/tests/support/mock_file.rs
241
295
tokio-rs/tokio:tokio/tests/support/mock_file.rs:8
} #[cfg(windows)] impl std::os::windows::io::AsRawHandle for File { fn as_raw_handle(&self) -> std::os::windows::io::RawHandle { unimplemented!(); } } #[cfg(windows)] impl std::os::windows::io::FromRawHandle for File { unsafe fn from_raw_handle(_: std::os::windows::io::RawHandle) -> Self { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/tests/support/mock_file.rs
281
295
tokio-rs/tokio:tokio/tests/support/mock_file.rs:5
} pub fn sync_data(&self) -> io::Result<()> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(SyncData(ret)) => ret, Some(op) => panic!("expected next call to be {:?}; was sync_all", op), None => panic!("did ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
827077409c8a8ef7adb4d05d522fcf6c1949c876
github
async-runtime
https://github.com/tokio-rs/tokio/blob/827077409c8a8ef7adb4d05d522fcf6c1949c876/tokio/tests/support/mock_file.rs
161
220
tokio-rs/tokio:tokio/tests/support/mock_file.rs:6
} impl Read for &'_ File { fn read(&mut self, dst: &mut [u8]) -> io::Result<usize> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(Read(Ok(data))) => { assert!(dst.len() >= data.len()); assert!(dst....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
827077409c8a8ef7adb4d05d522fcf6c1949c876
github
async-runtime
https://github.com/tokio-rs/tokio/blob/827077409c8a8ef7adb4d05d522fcf6c1949c876/tokio/tests/support/mock_file.rs
201
260
tokio-rs/tokio:tokio/tests/support/mock_file.rs:7
fn flush(&mut self) -> io::Result<()> { Ok(()) } } impl Seek for &'_ File { fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(Seek(expect, res)) => { a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/support/mock_file.rs
241
281
tokio-rs/tokio:tokio/tests/support/mock_file.rs:1
use std::collections::VecDeque; use std::fmt; use std::fs::{Metadata, Permissions}; use std::io; use std::io::prelude::*; use std::io::SeekFrom; use std::path::PathBuf; use std::sync::{Arc, Mutex}; pub struct File { shared: Arc<Mutex<Shared>>, } pub struct Handle { shared: Arc<Mutex<Shared>>, } struct Shared...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
c146f48f0b4f1fbecb1bed3d5a32222506d50704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c146f48f0b4f1fbecb1bed3d5a32222506d50704/tokio/tests/support/mock_file.rs
1
60
tokio-rs/tokio:tokio/tests/support/mock_file.rs:2
s.calls .push_back(Call::Read(Err(io::ErrorKind::Other.into()))); self } pub fn write(&self, data: &[u8]) -> &Self { let mut s = self.shared.lock().unwrap(); s.calls.push_back(Call::Write(Ok(data.to_owned()))); self } pub fn write_err(&self) -> &Self { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
c146f48f0b4f1fbecb1bed3d5a32222506d50704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c146f48f0b4f1fbecb1bed3d5a32222506d50704/tokio/tests/support/mock_file.rs
41
100
tokio-rs/tokio:tokio/tests/support/mock_file.rs:3
s.calls .push_back(Call::SyncAll(Err(io::ErrorKind::Other.into()))); self } pub fn sync_data(&self) -> &Self { let mut s = self.shared.lock().unwrap(); s.calls.push_back(Call::SyncData(Ok(()))); self } pub fn sync_data_err(&self) -> &Self { let mut s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
c146f48f0b4f1fbecb1bed3d5a32222506d50704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c146f48f0b4f1fbecb1bed3d5a32222506d50704/tokio/tests/support/mock_file.rs
81
140
tokio-rs/tokio:tokio/tests/support/mock_file.rs:4
let s = self.shared.lock().unwrap(); assert_eq!(0, s.calls.len()); } } } impl File { pub fn open(_: PathBuf) -> io::Result<File> { unimplemented!(); } pub fn create(_: PathBuf) -> io::Result<File> { unimplemented!(); } pub fn mock() -> (Handle, File) { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
c146f48f0b4f1fbecb1bed3d5a32222506d50704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c146f48f0b4f1fbecb1bed3d5a32222506d50704/tokio/tests/support/mock_file.rs
121
180
tokio-rs/tokio:tokio/tests/support/mock_file.rs:5
pub fn sync_data(&self) -> io::Result<()> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(SyncData(ret)) => ret, Some(op) => panic!("expected next call to be {:?}; was sync_all", op), None => panic!("did not exp...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
c146f48f0b4f1fbecb1bed3d5a32222506d50704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c146f48f0b4f1fbecb1bed3d5a32222506d50704/tokio/tests/support/mock_file.rs
161
220
tokio-rs/tokio:tokio/tests/support/mock_file.rs:6
impl Read for &'_ File { fn read(&mut self, dst: &mut [u8]) -> io::Result<usize> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(Read(Ok(data))) => { assert!(dst.len() >= data.len()); assert!(dst.len...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
c146f48f0b4f1fbecb1bed3d5a32222506d50704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c146f48f0b4f1fbecb1bed3d5a32222506d50704/tokio/tests/support/mock_file.rs
201
260
tokio-rs/tokio:tokio/tests/support/mock_file.rs:7
} } impl Seek for &'_ File { fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { use self::Call::*; let mut s = self.shared.lock().unwrap(); match s.calls.pop_front() { Some(Seek(expect, res)) => { assert_eq!(expect, pos); res } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_file.rs
MIT
c146f48f0b4f1fbecb1bed3d5a32222506d50704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c146f48f0b4f1fbecb1bed3d5a32222506d50704/tokio/tests/support/mock_file.rs
241
279
tokio-rs/tokio:tokio/tests/support/mock_pool.rs:1
use tokio::sync::oneshot; use std::cell::RefCell; use std::collections::VecDeque; use std::future::Future; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; thread_local! { static QUEUE: RefCell<VecDeque<Box<dyn FnOnce() + Send>>> = RefCell::new(VecDeque::new()) } #[derive(Debug)] pub(crate) struct...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_pool.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/tests/support/mock_pool.rs
1
60
tokio-rs/tokio:tokio/tests/support/mock_pool.rs:2
Ready(Ok(v)) => Ready(Ok(v)), Ready(Err(e)) => panic!("error = {:?}", e), Pending => Pending, } } } pub(crate) async fn asyncify<F, T>(f: F) -> io::Result<T> where F: FnOnce() -> io::Result<T> + Send + 'static, T: Send + 'static, { run(f).await? } pub(crate) fn len() ->...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_pool.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/tests/support/mock_pool.rs
41
66
tokio-rs/tokio:tokio/tests/support/mock_pool.rs:1
use tokio::sync::oneshot; use std::cell::RefCell; use std::collections::VecDeque; use std::future::Future; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; thread_local! { static QUEUE: RefCell<VecDeque<Box<dyn FnOnce() + Send>>> = RefCell::new(VecDeque::new()) } #[derive(Debug)] pub(crate) struct...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_pool.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/tests/support/mock_pool.rs
1
60
tokio-rs/tokio:tokio/tests/support/mock_pool.rs:2
Ready(Ok(v)) => Ready(v), Ready(Err(e)) => panic!("error = {:?}", e), Pending => Pending, } } } pub(crate) async fn asyncify<F, T>(f: F) -> io::Result<T> where F: FnOnce() -> io::Result<T> + Send + 'static, T: Send + 'static, { run(f).await } pub(crate) fn len() -> usiz...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mock_pool.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/tests/support/mock_pool.rs
41
66
tokio-rs/tokio:tokio/tests/support/mpsc_stream.rs:1
#![allow(dead_code)] use std::pin::Pin; use std::task::{Context, Poll}; use tokio::sync::mpsc::{self, Receiver, Sender, UnboundedReceiver, UnboundedSender}; use tokio_stream::Stream; struct UnboundedStream<T> { recv: UnboundedReceiver<T>, } impl<T> Stream for UnboundedStream<T> { type Item = T; fn poll_ne...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mpsc_stream.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/support/mpsc_stream.rs
1
42
tokio-rs/tokio:tokio/tests/support/mpsc_stream.rs:1
#![allow(dead_code)] use async_stream::stream; use tokio::sync::mpsc::{self, Sender, UnboundedSender}; use tokio_stream::Stream; pub fn unbounded_channel_stream<T: Unpin>() -> (UnboundedSender<T>, impl Stream<Item = T>) { let (tx, mut rx) = mpsc::unbounded_channel(); let stream = stream! { while let ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/mpsc_stream.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/support/mpsc_stream.rs
1
29
tokio-rs/tokio:tokio/tests/support/panic.rs:1
use std::panic; use std::sync::{Arc, Mutex}; pub fn test_panic<Func: FnOnce() + panic::UnwindSafe>(func: Func) -> Option<String> { static PANIC_MUTEX: Mutex<()> = Mutex::new(()); { let _guard = PANIC_MUTEX.lock(); let panic_file: Arc<Mutex<Option<String>>> = Arc::new(Mutex::new(None)); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/support/panic.rs
1
34
tokio-rs/tokio:tokio/tests/support/panic.rs:1
use parking_lot::{const_mutex, Mutex}; use std::panic; use std::sync::Arc; pub fn test_panic<Func: FnOnce() + panic::UnwindSafe>(func: Func) -> Option<String> { static PANIC_MUTEX: Mutex<()> = const_mutex(()); { let _guard = PANIC_MUTEX.lock(); let panic_file: Arc<Mutex<Option<String>>> = Arc:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/panic.rs
MIT
b51aa8f6f9cb205a8444743429cc80a86f982f1d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b51aa8f6f9cb205a8444743429cc80a86f982f1d/tokio/tests/support/panic.rs
1
34
tokio-rs/tokio:tokio/tests/support/signal.rs:1
pub fn send_signal(signal: libc::c_int) { use libc::{getpid, kill}; unsafe { let pid = getpid(); assert_eq!( kill(pid, signal), 0, "kill(pid = {}, {}) failed with error: {}", pid, signal, std::io::Error::last_os_error(), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/signal.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/support/signal.rs
1
15
tokio-rs/tokio:tokio/tests/support/signal.rs:1
pub fn send_signal(signal: libc::c_int) { use libc::{getpid, kill}; unsafe { assert_eq!(kill(getpid(), signal), 0); } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/support/signal.rs
MIT
227533d456fe32e48ffcd3796f1e6c8f9318b230
github
async-runtime
https://github.com/tokio-rs/tokio/blob/227533d456fe32e48ffcd3796f1e6c8f9318b230/tokio/tests/support/signal.rs
1
7
tokio-rs/tokio:tokio/tests/sync_atomic_waker.rs:1
#![warn(rust_2018_idioms)] use tokio::sync::AtomicWaker; use tokio_test::task; use std::task::Waker; trait AssertSend: Send {} trait AssertSync: Send {} impl AssertSend for AtomicWaker {} impl AssertSync for AtomicWaker {} impl AssertSend for Waker {} impl AssertSync for Waker {} #[test] fn basic_usage() { le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_atomic_waker.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_atomic_waker.rs
1
36
tokio-rs/tokio:tokio/tests/sync_barrier.rs:1
#![allow(clippy::unnecessary_operation)] #![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::Barrier; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; struct I...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_barrier.rs
1
60
tokio-rs/tokio:tokio/tests/sync_barrier.rs:2
let mut w = spawn(b.wait()); let wr = assert_ready!(w.poll()); assert!(wr.is_leader()); } { let mut w = spawn(b.wait()); let wr = assert_ready!(w.poll()); assert!(wr.is_leader()); } { let mut w = spawn(b.wait()); let wr = assert_ready!(w.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_barrier.rs
41
99
tokio-rs/tokio:tokio/tests/sync_barrier.rs:3
wait.push(w); } for w in &mut wait { assert_pending!(w.poll()); } // pass the barrier let mut w = spawn(b.wait()); let mut found_leader = assert_ready!(w.poll()).is_leader(); for mut w in wait { let wr = assert_ready!(w.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_barrier.rs
81
99
tokio-rs/tokio:tokio/tests/sync_barrier.rs:1
#![allow(clippy::unnecessary_operation)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::Barrier; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; struct IsSend<T: Send>(T); #[test] fn bar...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_barrier.rs
1
60
tokio-rs/tokio:tokio/tests/sync_barrier.rs:1
#![allow(clippy::unnecessary_operation)] #![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::Barrier; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; struct I...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_barrier.rs
1
60
tokio-rs/tokio:tokio/tests/sync_barrier.rs:1
#![allow(clippy::unnecessary_operation)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::Barrier; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; struct IsSend<T: Send>(T); #[test] fn ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_barrier.rs
1
60
tokio-rs/tokio:tokio/tests/sync_barrier.rs:1
#![allow(clippy::unnecessary_operation)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::Barrier; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; struct IsSend<T: Send>(T); #[test] fn barrier_future_is_send() { let b = Barrier::new(0); IsSend(b.wait()); } #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/sync_barrier.rs
1
60
tokio-rs/tokio:tokio/tests/sync_barrier.rs:2
} { let mut w = spawn(b.wait()); let wr = assert_ready!(w.poll()); assert!(wr.is_leader()); } { let mut w = spawn(b.wait()); let wr = assert_ready!(w.poll()); assert!(wr.is_leader()); } } #[test] fn tango() { let b = Barrier::new(2); let mut w1 =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/sync_barrier.rs
41
96
tokio-rs/tokio:tokio/tests/sync_barrier.rs:3
assert_pending!(w.poll()); } // pass the barrier let mut w = spawn(b.wait()); let mut found_leader = assert_ready!(w.poll()).is_leader(); for mut w in wait { let wr = assert_ready!(w.poll()); if wr.is_leader() { assert!(!found_leader); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/sync_barrier.rs
81
96
tokio-rs/tokio:tokio/tests/sync_barrier.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::Barrier; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; struct IsSend<T: Send>(T); #[test] fn barrier_future_is_send() { let b = Barrier::new(0); IsSend(b.wait()); } #[test] fn zero_does_not_block() { let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_barrier.rs
1
60
tokio-rs/tokio:tokio/tests/sync_barrier.rs:2
{ let mut w = spawn(b.wait()); let wr = assert_ready!(w.poll()); assert!(wr.is_leader()); } { let mut w = spawn(b.wait()); let wr = assert_ready!(w.poll()); assert!(wr.is_leader()); } } #[test] fn tango() { let b = Barrier::new(2); let mut w1 = spawn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_barrier.rs
41
95
tokio-rs/tokio:tokio/tests/sync_barrier.rs:3
} // pass the barrier let mut w = spawn(b.wait()); let mut found_leader = assert_ready!(w.poll()).is_leader(); for mut w in wait { let wr = assert_ready!(w.poll()); if wr.is_leader() { assert!(!found_leader); found_leader = true; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_barrier.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_barrier.rs
81
95
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
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/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"), } }; } #[allow(unused)] trait AssertSend: Send + Sync {} impl AssertSend for bro...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:3
assert_empty!(rx1); assert_empty!(rx2); 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() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
81
140
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:4
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!(val1, "hello"); assert_eq!(val2, "hello"); drop((recv1, recv2)); le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:5
assert_pending!(task2.poll()); tx.send("hello").unwrap(); assert!(task2.is_woken()); } #[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.r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
161
220
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:6
assert!(recv1.is_woken()); 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, "th...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
201
260
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
assert_eq!("one", assert_recv!(rx1)); 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!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
#[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn zero_capacity() { broadcast::channel::<()>(0); } #[test] #[should_panic] #[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn capacity_too_big() { broadcast::channel::<()>(1 + (usize::MAX >> 1)); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:9
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_pending!(recv1.poll()); asser...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
321
380
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:10
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); } #[test] fn single_capacity_recvs_after_dr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
361
420
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_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/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
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
441
500
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:13
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 assert_empty!(rx_resub); assert_eq!(assert_recv!(rx), 1); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/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(); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/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() { let (tx, mut rx1) = broadcast::channel(16); let mut rx2 = tx.subscribe(); for _ in 0..1000 { match rand::random_range(0..4) { 0 => ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
561
620
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 waker in t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
601
660
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:17
} #[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
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
641
700
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
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_broadcast.rs
681
722
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, assert_r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/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!("is not closed"), } }; } #[allow(unused)] trait AssertSend: Send + Sync {} impl AssertSend for broadcast::Sender<i32> {} impl AssertSend for...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/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
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
81
140
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:4
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()); let mut recv2 = task::spawn(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:5
assert!(task2.is_woken()); } #[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()); asse...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
161
220
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
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
201
260
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:7
// 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")); assert_ok!(tx.send("five")); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
241
300
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:8
} #[test] #[should_panic] #[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn capacity_too_big() { broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] #[cfg(panic = "unwind")] #[cfg(not(target_family = "wasm"))] // wasm currently doesn't support unwinding fn panic_in_clone() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:9
#[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_pending!(recv1.poll()); assert_pending!(recv2.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
321
380
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:10
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); } #[test] fn single_capacity_recvs_after_drop_1() { let (tx, mut rx) = broadcast::ch...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
361
420
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:11
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_after_wrap_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
401
460
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:12
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.try_recv(), 1); assert_eq!(assert_recv!(rx), 2); assert_eq!(assert_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
441
500
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).unwr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
481
540
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:14
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(); assert_eq!(tx.len(), 0); assert!(tx.is_empty()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
521
580
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:15
#[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_range(0..4) { 0 => { let _ = r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
561
620
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 waker in the rece...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
601
660
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:17
#[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()); } } => {}, _ = t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_broadcast.rs
MIT
484cb52d8d21cb8156decbeba9569651fcc09d0d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/tests/sync_broadcast.rs
641
668
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
da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400/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"), } }; } #[allow(unused)] trait AssertSend: Send + Sync {} impl AssertSend for bro...
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
41
100
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:3
assert_empty!(rx2); 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) =...
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
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
da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400/tokio/tests/sync_broadcast.rs
121
180
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:5
tx.send("hello").unwrap(); assert!(task2.is_woken()); } #[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!...
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
161
220
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
da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400/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() { broadcast::channel::<()>(1 + (usize::MAX >> 1)); } #[test] #[cfg(panic = "unwind")] #[cfg(not(target_family = "wasm"))] // wasm cu...
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
281
340
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:9
} #[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_pending!(recv1.poll()); assert_pending!(recv2.poll()); ...
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
321
380
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:10
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); } #[test] fn single_capacity_recvs_after_dr...
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
361
420
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
da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400/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
da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400/tokio/tests/sync_broadcast.rs
441
500
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
da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da292dfb66ef34fdfbb6aa1f23c3b2456ca4d400/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(); a...
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
521
580
tokio-rs/tokio:tokio/tests/sync_broadcast.rs:15
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_range(0..4) { 0 =>...
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
561
620