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_once_cell.rs:7
time::advance(Duration::from_millis(1)).await; time::resume(); let result1 = handle1.await.unwrap(); assert!(result1.is_err()); let result2 = handle2.await.unwrap(); assert_eq!(*result2.unwrap(), 10); }); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_once_cell.rs
241
250
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::mem; use std::sync::atomic::{AtomicU32, Ordering}; use std::time::Duration; use tokio::runtime; use tokio::sync::OnceCell; use tokio::sync::SetError; use tokio::time; #[test] fn drop_cell() { static NUM_DROPS: AtomicU32 = AtomicU32::new(0); struct...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_once_cell.rs
1
60
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:2
impl Drop for Foo { fn drop(&mut self) { NUM_DROPS.fetch_add(1, Ordering::Release); } } { let once_cell = OnceCell::new_with(Some(fooer)); assert!(once_cell.initialized()); } assert!(NUM_DROPS.load(Ordering::Acquire) == 1); } #[test] fn drop_into_inner() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_once_cell.rs
41
100
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:3
static NUM_DROPS: AtomicU32 = AtomicU32::new(0); struct Foo {} let fooer = Foo {}; impl Drop for Foo { fn drop(&mut self) { NUM_DROPS.fetch_add(1, Ordering::Release); } } let once_cell = OnceCell::new_with(Some(fooer)); let fooer = once_cell.into_inner(); let ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_once_cell.rs
81
140
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:4
async fn func_ok() -> Result<u32, ()> { Ok(10) } async fn func_panic() -> u32 { time::sleep(Duration::from_millis(1)).await; panic!(); } async fn sleep_and_set() -> u32 { // Simulate sleep by pausing time and waiting for another thread to // resume clock when calling `set`, then finding the cell b...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_once_cell.rs
121
180
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:5
let result2 = handle2.await.unwrap(); assert_eq!(*result1, 5); assert_eq!(*result2, 5); }); } #[test] fn get_or_init_panic() { let rt = runtime::Builder::new_current_thread() .enable_time() .build() .unwrap(); static ONCE: OnceCell<u32> = OnceCell::const_new(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_once_cell.rs
161
220
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:6
rt.block_on(async { let _ = rt.spawn(async { ONCE.set(5) }).await; let value = ONCE.get().unwrap(); assert_eq!(*value, 5); }); } #[test] fn get_uninit() { static ONCE: OnceCell<u32> = OnceCell::const_new(); let uninit = ONCE.get(); assert!(uninit.is_none()); } #[test] fn set_tw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_once_cell.rs
201
260
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:7
time::advance(Duration::from_millis(2)).await; let result1 = handle1.await.unwrap(); let result2 = handle2.await.unwrap(); assert_eq!(*result1, 5); assert!(result2.err().unwrap().is_initializing_err()); }); } #[test] fn get_or_try_init() { let rt = runtime::Builder::new_curren...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_once_cell.rs
241
274
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::mem; use std::ops::Drop; use std::sync::atomic::{AtomicU32, Ordering}; use std::time::Duration; use tokio::runtime; use tokio::sync::OnceCell; use tokio::sync::SetError; use tokio::time; #[test] fn drop_cell() { static NUM_DROPS: AtomicU32 = AtomicU32:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
efe3ab679a05f3da3fcc511a44120239830254f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/tests/sync_once_cell.rs
1
60
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:2
let fooer = Foo {}; impl Drop for Foo { fn drop(&mut self) { NUM_DROPS.fetch_add(1, Ordering::Release); } } { let once_cell = OnceCell::new_with(Some(fooer)); assert!(once_cell.initialized()); } assert!(NUM_DROPS.load(Ordering::Acquire) == 1); } #[test]...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
efe3ab679a05f3da3fcc511a44120239830254f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/tests/sync_once_cell.rs
41
100
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:3
fn drop_into_inner_new_with() { static NUM_DROPS: AtomicU32 = AtomicU32::new(0); struct Foo {} let fooer = Foo {}; impl Drop for Foo { fn drop(&mut self) { NUM_DROPS.fetch_add(1, Ordering::Release); } } let once_cell = OnceCell::new_with(Some(fooer)); let fooe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
efe3ab679a05f3da3fcc511a44120239830254f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/tests/sync_once_cell.rs
81
140
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:4
async fn func_ok() -> Result<u32, ()> { Ok(10) } async fn func_panic() -> u32 { time::sleep(Duration::from_millis(1)).await; panic!(); } async fn sleep_and_set() -> u32 { // Simulate sleep by pausing time and waiting for another thread to // resume clock when calling `set`, then finding the cell b...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
efe3ab679a05f3da3fcc511a44120239830254f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/tests/sync_once_cell.rs
121
180
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:5
let result1 = handle1.await.unwrap(); let result2 = handle2.await.unwrap(); assert_eq!(*result1, 5); assert_eq!(*result2, 5); }); } #[test] fn get_or_init_panic() { let rt = runtime::Builder::new_current_thread() .enable_time() .build() .unwrap(); static ON...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
efe3ab679a05f3da3fcc511a44120239830254f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/tests/sync_once_cell.rs
161
220
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:6
static ONCE: OnceCell<u32> = OnceCell::const_new(); rt.block_on(async { let _ = rt.spawn(async { ONCE.set(5) }).await; let value = ONCE.get().unwrap(); assert_eq!(*value, 5); }); } #[test] fn get_uninit() { static ONCE: OnceCell<u32> = OnceCell::const_new(); let uninit = ONCE.g...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
efe3ab679a05f3da3fcc511a44120239830254f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/efe3ab679a05f3da3fcc511a44120239830254f2/tokio/tests/sync_once_cell.rs
201
260
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::mem; use std::ops::Drop; use std::sync::atomic::{AtomicU32, Ordering}; use tokio::sync::OnceCell; #[test] fn drop_cell() { static NUM_DROPS: AtomicU32 = AtomicU32::new(0); struct Foo {} let fooer = Foo {}; impl Drop for Foo { fn ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/sync_once_cell.rs
1
60
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:2
NUM_DROPS.fetch_add(1, Ordering::Release); } } { let once_cell = OnceCell::new_with(Some(fooer)); assert!(once_cell.initialized()); } assert!(NUM_DROPS.load(Ordering::Acquire) == 1); } #[test] fn drop_into_inner() { static NUM_DROPS: AtomicU32 = AtomicU32::new(0); stru...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/sync_once_cell.rs
41
100
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:3
let fooer = Foo {}; impl Drop for Foo { fn drop(&mut self) { NUM_DROPS.fetch_add(1, Ordering::Release); } } let once_cell = OnceCell::new_with(Some(fooer)); let fooer = once_cell.into_inner(); let count = NUM_DROPS.load(Ordering::Acquire); assert!(count == 0); m...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/sync_once_cell.rs
81
140
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:4
10 } async fn func_err() -> Result<u32, ()> { Err(()) } async fn func_ok() -> Result<u32, ()> { Ok(10) } async fn func_panic() -> u32 { time::sleep(Duration::from_millis(1)).await; panic!(); } async fn sleep_and_set() -> u32 { // Simulate sleep...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/sync_once_cell.rs
121
180
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:5
static ONCE: OnceCell<u32> = OnceCell::const_new(); rt.block_on(async { let handle1 = rt.spawn(async { ONCE.get_or_init(func1).await }); let handle2 = rt.spawn(async { ONCE.get_or_init(func2).await }); time::advance(Duration::from_millis(1)).await; time::resume(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/sync_once_cell.rs
161
220
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:6
} #[test] fn set_and_get() { let rt = runtime::Builder::new_current_thread() .enable_time() .build() .unwrap(); static ONCE: OnceCell<u32> = OnceCell::const_new(); rt.block_on(async { let _ = rt.spawn(async { ONCE.set(5) }).await; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/sync_once_cell.rs
201
260
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:7
.unwrap(); static ONCE: OnceCell<u32> = OnceCell::const_new(); rt.block_on(async { time::pause(); let handle1 = rt.spawn(async { ONCE.get_or_init(sleep_and_set).await }); let handle2 = rt.spawn(async { advance_time_and_set(&ONCE, 10).await }); time::ad...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c693ccd210c7a318957b0701f4a9632b2d545d6a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/sync_once_cell.rs
241
285
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::mem; use std::ops::Drop; use std::sync::atomic::{AtomicU32, Ordering}; use std::time::Duration; use tokio::runtime; use tokio::sync::{OnceCell, SetError}; use tokio::time; async fn func1() -> u32 { 5 } async fn func2() -> u32 { time::sleep(Duratio...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
845626410a2e42902882f9750a9f8e2b38cf5a36
github
async-runtime
https://github.com/tokio-rs/tokio/blob/845626410a2e42902882f9750a9f8e2b38cf5a36/tokio/tests/sync_once_cell.rs
1
60
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:2
async fn advance_time_and_set(cell: &'static OnceCell<u32>, v: u32) -> Result<(), SetError<u32>> { time::advance(Duration::from_millis(1)).await; cell.set(v) } #[test] fn get_or_init() { let rt = runtime::Builder::new_current_thread() .enable_time() .start_paused(true) .build() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
845626410a2e42902882f9750a9f8e2b38cf5a36
github
async-runtime
https://github.com/tokio-rs/tokio/blob/845626410a2e42902882f9750a9f8e2b38cf5a36/tokio/tests/sync_once_cell.rs
41
100
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:3
rt.block_on(async { time::pause(); let handle1 = rt.spawn(async { ONCE.get_or_init(func1).await }); let handle2 = rt.spawn(async { ONCE.get_or_init(func_panic).await }); time::advance(Duration::from_millis(1)).await; let result1 = handle1.await.unwrap(); let result2 = ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
845626410a2e42902882f9750a9f8e2b38cf5a36
github
async-runtime
https://github.com/tokio-rs/tokio/blob/845626410a2e42902882f9750a9f8e2b38cf5a36/tokio/tests/sync_once_cell.rs
81
140
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:4
fn set_twice() { static ONCE: OnceCell<u32> = OnceCell::const_new(); let first = ONCE.set(5); assert_eq!(first, Ok(())); let second = ONCE.set(6); assert!(second.err().unwrap().is_already_init_err()); } #[test] fn set_while_initializing() { let rt = runtime::Builder::new_current_thread() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
845626410a2e42902882f9750a9f8e2b38cf5a36
github
async-runtime
https://github.com/tokio-rs/tokio/blob/845626410a2e42902882f9750a9f8e2b38cf5a36/tokio/tests/sync_once_cell.rs
121
180
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:5
.unwrap(); static ONCE: OnceCell<u32> = OnceCell::const_new(); rt.block_on(async { let handle1 = rt.spawn(async { ONCE.get_or_try_init(func_err).await }); let handle2 = rt.spawn(async { ONCE.get_or_try_init(func_ok).await }); time::advance(Duration::from_millis(1)).await; time...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
845626410a2e42902882f9750a9f8e2b38cf5a36
github
async-runtime
https://github.com/tokio-rs/tokio/blob/845626410a2e42902882f9750a9f8e2b38cf5a36/tokio/tests/sync_once_cell.rs
161
220
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:6
#[test] fn drop_cell_new_with() { static NUM_DROPS: AtomicU32 = AtomicU32::new(0); struct Foo {} let fooer = Foo {}; impl Drop for Foo { fn drop(&mut self) { NUM_DROPS.fetch_add(1, Ordering::Release); } } { let once_cell = OnceCell::new_with(Some(fooer)); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
845626410a2e42902882f9750a9f8e2b38cf5a36
github
async-runtime
https://github.com/tokio-rs/tokio/blob/845626410a2e42902882f9750a9f8e2b38cf5a36/tokio/tests/sync_once_cell.rs
201
260
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:7
assert!(count == 0); drop(fooer); let count = NUM_DROPS.load(Ordering::Acquire); assert!(count == 1); } #[test] fn drop_into_inner_new_with() { static NUM_DROPS: AtomicU32 = AtomicU32::new(0); struct Foo {} let fooer = Foo {}; impl Drop for Foo { fn drop(&mut self) { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
845626410a2e42902882f9750a9f8e2b38cf5a36
github
async-runtime
https://github.com/tokio-rs/tokio/blob/845626410a2e42902882f9750a9f8e2b38cf5a36/tokio/tests/sync_once_cell.rs
241
274
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:7
assert!(count == 0); drop(fooer); let count = NUM_DROPS.load(Ordering::Acquire); assert!(count == 1); } #[test] fn drop_into_inner_new_with() { static NUM_DROPS: AtomicU32 = AtomicU32::new(0); struct Foo {} let fooer = Foo {}; impl Drop for Foo { fn drop(&mut self) { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
f6e4e85dfb60459e3ff430a7480f37338548e014
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f6e4e85dfb60459e3ff430a7480f37338548e014/tokio/tests/sync_once_cell.rs
241
268
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![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; #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(all(target_family = "...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:2
let (tx, rx) = oneshot::channel(); let mut rx = task::spawn(rx); assert_pending!(rx.poll()); assert_ok!(tx.send(1)); assert!(rx.is_woken()); let val = assert_ready_ok!(rx.poll()); assert_eq!(val, 1); } #[maybe_tokio_test] async fn async_send_recv() { let (tx, rx) = oneshot::channel(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
41
100
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:3
assert_err!(tx.send(1)); // Second, via poll_closed(); let (tx, rx) = oneshot::channel(); let mut tx = task::spawn(tx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); drop(rx); assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
81
140
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:4
let value = assert_ready_ok!(rx.poll()); assert_eq!(value, 1); // Second, without the message sent let (tx, rx) = oneshot::channel::<i32>(); let mut tx = task::spawn(tx); let mut rx = task::spawn(rx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); rx.close(); assert!(tx....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
121
180
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
assert_ok!(tx.send(1)); rx.close(); let val = assert_ok!(rx.try_recv()); assert_eq!(1, val); // Second, without the message sent let (tx, mut rx) = oneshot::channel::<i32>(); let mut tx = task::spawn(tx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); rx.close(); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:6
tx.send(17).unwrap(); assert_eq!(17, rx.try_recv().unwrap()); rx.close(); } #[test] fn try_recv_after_completion() { let (tx, mut rx) = oneshot::channel::<i32>(); tx.send(17).unwrap(); assert_eq!(17, rx.try_recv().unwrap()); assert_eq!(Err(TryRecvError::Closed), rx.try_recv()); rx.close(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
201
260
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:7
assert_eq!(1, tx_task.waker_ref_count()); assert_eq!(1, rx_task.waker_ref_count()); } #[test] fn receiver_changes_task() { let (tx, mut rx) = oneshot::channel(); let mut task1 = task::spawn(()); let mut task2 = task::spawn(()); assert_pending!(task1.enter(|cx, _| Pin::new(&mut rx).poll(cx))); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
241
300
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:8
assert_eq!(1, task2.waker_ref_count()); assert_pending!(task2.enter(|cx, _| tx.poll_closed(cx))); assert_eq!(1, task1.waker_ref_count()); assert_eq!(2, task2.waker_ref_count()); drop(rx); assert!(!task1.is_woken()); assert!(task2.is_woken()); assert_ready!(task2.enter(|cx, _| tx.poll_cl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
281
340
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:9
fn receiver_is_terminated_try_recv() { let (tx, mut rx) = oneshot::channel::<i32>(); assert!( !rx.is_terminated(), "channel is NOT terminated before value is sent" ); tx.send(17).unwrap(); assert!( !rx.is_terminated(), "channel is NOT terminated after value is sent" ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
321
380
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:10
assert!( rx.is_terminated(), "channel IS terminated after value is read" ); } #[test] fn receiver_is_terminated_rx_close() { let (_tx, mut rx) = oneshot::channel::<i32>(); assert!( !rx.is_terminated(), "channel is NOT terminated before closing" ); rx.close(); ass...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
361
420
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:11
assert!(rx.is_empty(), "channel IS empty after value is read"); } #[test] fn receiver_is_empty_try_recv() { let (tx, mut rx) = oneshot::channel::<i32>(); assert!(rx.is_empty(), "channel IS empty before value is sent"); tx.send(17).unwrap(); assert!(!rx.is_empty(), "channel is NOT empty after value is ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_oneshot.rs
401
440
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:10
assert!( rx.is_terminated(), "channel IS terminated after value is read" ); } #[test] fn receiver_is_terminated_rx_close() { let (_tx, mut rx) = oneshot::channel::<i32>(); assert!( !rx.is_terminated(), "channel is NOT terminated before closing" ); rx.close(); ass...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
17117b591e7a15f7913b529a5c6aa38a7b3c27e1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/17117b591e7a15f7913b529a5c6aa38a7b3c27e1/tokio/tests/sync_oneshot.rs
361
388
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:7
assert_eq!(1, tx_task.waker_ref_count()); assert_eq!(1, rx_task.waker_ref_count()); } #[test] fn receiver_changes_task() { let (tx, mut rx) = oneshot::channel(); let mut task1 = task::spawn(()); let mut task2 = task::spawn(()); assert_pending!(task1.enter(|cx, _| Pin::new(&mut rx).poll(cx))); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_oneshot.rs
241
294
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:8
assert_eq!(1, task2.waker_ref_count()); assert_pending!(task2.enter(|cx, _| tx.poll_closed(cx))); assert_eq!(1, task1.waker_ref_count()); assert_eq!(2, task2.waker_ref_count()); drop(rx); assert!(!task1.is_woken()); assert!(task2.is_woken()); assert_ready!(task2.enter(|cx, _| tx.poll_cl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_oneshot.rs
281
294
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![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; #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(all(target_family = "...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:2
assert_pending!(rx.poll()); assert_ok!(tx.send(1)); assert!(rx.is_woken()); let val = assert_ready_ok!(rx.poll()); assert_eq!(val, 1); } #[maybe_tokio_test] async fn async_send_recv() { let (tx, rx) = oneshot::channel(); assert_ok!(tx.send(1)); assert_eq!(1, assert_ok!(rx.await)); } #[...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_oneshot.rs
41
100
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:3
let (tx, rx) = oneshot::channel(); let mut tx = task::spawn(tx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); drop(rx); assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_err!(tx.into_inner().send(1)); } #[tok...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_oneshot.rs
81
140
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:4
// Second, without the message sent let (tx, rx) = oneshot::channel::<i32>(); let mut tx = task::spawn(tx); let mut rx = task::spawn(rx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); rx.close(); assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_oneshot.rs
121
180
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
let val = assert_ok!(rx.try_recv()); assert_eq!(1, val); // Second, without the message sent let (tx, mut rx) = oneshot::channel::<i32>(); let mut tx = task::spawn(tx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); rx.close(); assert!(tx.is_woken()); assert!(tx.is_close...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:6
rx.close(); } #[test] fn try_recv_after_completion() { let (tx, mut rx) = oneshot::channel::<i32>(); tx.send(17).unwrap(); assert_eq!(17, rx.try_recv().unwrap()); assert_eq!(Err(TryRecvError::Closed), rx.try_recv()); rx.close(); } #[test] fn try_recv_after_completion_await() { let (tx, rx) =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_oneshot.rs
201
260
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:7
} #[test] fn receiver_changes_task() { let (tx, mut rx) = oneshot::channel(); let mut task1 = task::spawn(()); let mut task2 = task::spawn(()); assert_pending!(task1.enter(|cx, _| Pin::new(&mut rx).poll(cx))); assert_eq!(2, task1.waker_ref_count()); assert_eq!(1, task2.waker_ref_count()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_oneshot.rs
241
291
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:8
assert_eq!(1, task1.waker_ref_count()); assert_eq!(2, task2.waker_ref_count()); drop(rx); assert!(!task1.is_woken()); assert!(task2.is_woken()); assert_ready!(task2.enter(|cx, _| tx.poll_closed(cx))); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_oneshot.rs
281
291
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(tokio_wasm_not_wasi))] use tokio::test as maybe_tokio_test; use tokio::sync::oneshot; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
let val = assert_ok!(rx.try_recv()); assert_eq!(1, val); // Second, without the message sent let (tx, mut rx) = oneshot::channel::<i32>(); let mut tx = task::spawn(tx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); rx.close(); assert!(tx.is_woken()); assert!(tx.is_close...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![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; #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(all(target_arch = "wa...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
let val = assert_ok!(rx.try_recv()); assert_eq!(1, val); // Second, without the message sent let (tx, mut rx) = oneshot::channel::<i32>(); let mut tx = task::spawn(tx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); rx.close(); assert!(tx.is_woken()); assert!(tx.is_close...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(target_arch = "wasm32"))] use tokio::test as maybe_tokio_test; use tokio::sync::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
34b8ebbe662cd8c818bc017e81a717a465ab1f01
github
async-runtime
https://github.com/tokio-rs/tokio/blob/34b8ebbe662cd8c818bc017e81a717a465ab1f01/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
let val = assert_ok!(rx.try_recv()); assert_eq!(1, val); // Second, without the message sent let (tx, mut rx) = oneshot::channel::<i32>(); let mut tx = task::spawn(tx); assert_pending!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); rx.close(); assert!(tx.is_woken()); assert!(tx.is_close...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:6
rx.close(); } #[test] fn try_recv_after_completion() { let (tx, mut rx) = oneshot::channel::<i32>(); tx.send(17).unwrap(); assert_eq!(17, rx.try_recv().unwrap()); assert_eq!(Err(TryRecvError::Closed), rx.try_recv()); rx.close(); } #[test] fn drops_tasks() { let (mut tx, mut rx) = oneshot::ch...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_oneshot.rs
201
260
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:7
assert_eq!(1, task2.waker_ref_count()); assert_pending!(task2.enter(|cx, _| Pin::new(&mut rx).poll(cx))); assert_eq!(1, task1.waker_ref_count()); assert_eq!(2, task2.waker_ref_count()); assert_ok!(tx.send(1)); assert!(!task1.is_woken()); assert!(task2.is_woken()); assert_ready_ok!(task2...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_oneshot.rs
241
279
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::oneshot; use tokio::sync::oneshot::error::TryRecvError; use tokio_test::*; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; trait AssertSend: Send {} impl AssertSend for oneshot::Sender<i32> {} impl AssertSend for onesho...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
f93bc9bad1e1a92328c62947e00e93c92e3b7614
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f93bc9bad1e1a92328c62947e00e93c92e3b7614/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:2
} #[tokio::test] async fn async_send_recv() { let (tx, rx) = oneshot::channel(); assert_ok!(tx.send(1)); assert_eq!(1, assert_ok!(rx.await)); } #[test] fn close_tx() { let (tx, rx) = oneshot::channel::<i32>(); let mut rx = task::spawn(rx); assert_pending!(rx.poll()); drop(tx); asse...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
f93bc9bad1e1a92328c62947e00e93c92e3b7614
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f93bc9bad1e1a92328c62947e00e93c92e3b7614/tokio/tests/sync_oneshot.rs
41
100
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:3
assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_err!(tx.into_inner().send(1)); } #[tokio::test] async fn async_rx_closed() { let (mut tx, rx) = oneshot::channel::<()>(); tokio::spawn(async move { drop(rx); }); tx.c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
f93bc9bad1e1a92328c62947e00e93c92e3b7614
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f93bc9bad1e1a92328c62947e00e93c92e3b7614/tokio/tests/sync_oneshot.rs
81
140
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:4
assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_err!(tx.into_inner().send(1)); assert_ready_err!(rx.poll()); // Again, but without sending the value this time let (tx, rx) = oneshot::channel::<i32>(); let mut tx = task::spaw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
f93bc9bad1e1a92328c62947e00e93c92e3b7614
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f93bc9bad1e1a92328c62947e00e93c92e3b7614/tokio/tests/sync_oneshot.rs
121
180
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
rx.close(); assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_err!(rx.try_recv()); } #[test] #[should_panic] fn close_try_recv_poll() { let (_tx, rx) = oneshot::channel::<i32>(); let mut rx = task::spawn(rx); rx.close(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
f93bc9bad1e1a92328c62947e00e93c92e3b7614
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f93bc9bad1e1a92328c62947e00e93c92e3b7614/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:6
assert_eq!(Err(TryRecvError::Closed), rx.try_recv()); rx.close(); } #[test] fn drops_tasks() { let (mut tx, mut rx) = oneshot::channel::<i32>(); let mut tx_task = task::spawn(()); let mut rx_task = task::spawn(()); assert_pending!(tx_task.enter(|cx, _| tx.poll_closed(cx))); assert_pending!(rx_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
f93bc9bad1e1a92328c62947e00e93c92e3b7614
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f93bc9bad1e1a92328c62947e00e93c92e3b7614/tokio/tests/sync_oneshot.rs
201
260
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:7
assert!(task2.is_woken()); assert_ready_ok!(task2.enter(|cx, _| Pin::new(&mut rx).poll(cx))); } #[test] fn sender_changes_task() { let (mut tx, rx) = oneshot::channel::<i32>(); let mut task1 = task::spawn(()); let mut task2 = task::spawn(()); assert_pending!(task1.enter(|cx, _| tx.poll_closed(cx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
f93bc9bad1e1a92328c62947e00e93c92e3b7614
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f93bc9bad1e1a92328c62947e00e93c92e3b7614/tokio/tests/sync_oneshot.rs
241
269
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::oneshot; use tokio_test::*; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; trait AssertSend: Send {} impl AssertSend for oneshot::Sender<i32> {} impl AssertSend for oneshot::Receiver<i32> {} trait SenderExt { fn p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
112e160b623e3bef1603bf522abbdaacbc6c94e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:2
#[tokio::test] async fn async_send_recv() { let (tx, rx) = oneshot::channel(); assert_ok!(tx.send(1)); assert_eq!(1, assert_ok!(rx.await)); } #[test] fn close_tx() { let (tx, rx) = oneshot::channel::<i32>(); let mut rx = task::spawn(rx); assert_pending!(rx.poll()); drop(tx); assert!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
112e160b623e3bef1603bf522abbdaacbc6c94e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/tests/sync_oneshot.rs
41
100
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:3
assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_err!(tx.into_inner().send(1)); } #[tokio::test] async fn async_rx_closed() { let (mut tx, rx) = oneshot::channel::<()>(); tokio::spawn(async move { drop(rx); }); tx.closed().await; } #[test] fn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
112e160b623e3bef1603bf522abbdaacbc6c94e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/tests/sync_oneshot.rs
81
140
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:4
assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_err!(tx.into_inner().send(1)); assert_ready_err!(rx.poll()); // Again, but without sending the value this time let (tx, rx) = oneshot::channel::<i32>(); let mut tx = task::spawn(tx); let mut rx = task...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
112e160b623e3bef1603bf522abbdaacbc6c94e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/tests/sync_oneshot.rs
121
180
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
rx.close(); assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_err!(rx.try_recv()); } #[test] #[should_panic] fn close_try_recv_poll() { let (_tx, rx) = oneshot::channel::<i32>(); let mut rx = task::spawn(rx); rx.close(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
112e160b623e3bef1603bf522abbdaacbc6c94e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:6
drop(tx); drop(rx); assert_eq!(1, tx_task.waker_ref_count()); assert_eq!(1, rx_task.waker_ref_count()); } #[test] fn receiver_changes_task() { let (tx, mut rx) = oneshot::channel(); let mut task1 = task::spawn(()); let mut task2 = task::spawn(()); assert_pending!(task1.enter(|cx, _| Pin:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
112e160b623e3bef1603bf522abbdaacbc6c94e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/tests/sync_oneshot.rs
201
257
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:7
assert_pending!(task1.enter(|cx, _| tx.poll_closed(cx))); assert_eq!(2, task1.waker_ref_count()); assert_eq!(1, task2.waker_ref_count()); assert_pending!(task2.enter(|cx, _| tx.poll_closed(cx))); assert_eq!(1, task1.waker_ref_count()); assert_eq!(2, task2.waker_ref_count()); drop(rx); a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
112e160b623e3bef1603bf522abbdaacbc6c94e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/tests/sync_oneshot.rs
241
257
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
rx.close(); assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_err!(rx.try_recv()); } #[test] #[should_panic] fn close_try_recv_poll() { let (_tx, rx) = oneshot::channel::<i32>(); let mut rx = task::spawn(rx); rx.close(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
7ec6d88b21ea3e5531176f526a51dae0a4513025
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ec6d88b21ea3e5531176f526a51dae0a4513025/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:6
let (tx, mut rx) = oneshot::channel(); let mut task1 = task::spawn(()); let mut task2 = task::spawn(()); assert_pending!(task1.enter(|cx, _| Pin::new(&mut rx).poll(cx))); assert_eq!(2, task1.waker_ref_count()); assert_eq!(1, task2.waker_ref_count()); assert_pending!(task2.enter(|cx, _| Pin::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
7ec6d88b21ea3e5531176f526a51dae0a4513025
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ec6d88b21ea3e5531176f526a51dae0a4513025/tokio/tests/sync_oneshot.rs
201
247
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::oneshot; use tokio_test::*; use std::future::Future; use std::pin::Pin; trait AssertSend: Send {} impl AssertSend for oneshot::Sender<i32> {} impl AssertSend for oneshot::Receiver<i32> {} #[test] fn send_recv() { let (tx, rx) = oneshot::chann...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:2
assert_pending!(rx.poll()); drop(tx); assert!(rx.is_woken()); assert_ready_err!(rx.poll()); } #[test] fn close_rx() { // First, without checking poll_closed() // let (tx, _) = oneshot::channel(); assert_err!(tx.send(1)); // Second, via poll_closed(); let (tx, rx) = oneshot::cha...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_oneshot.rs
41
100
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:3
tx.closed().await; } #[test] fn explicit_close_poll() { // First, with message sent let (tx, rx) = oneshot::channel(); let mut rx = task::spawn(rx); assert_ok!(tx.send(1)); rx.close(); let value = assert_ready_ok!(rx.poll()); assert_eq!(value, 1); // Second, without the message sent...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_oneshot.rs
81
140
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:4
rx.close(); assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_ready_err!(rx.poll()); } #[test] fn explicit_close_try_recv() { // First, with message sent let (tx, mut rx) = oneshot::channel(); assert_ok!(tx.send(1)); rx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_oneshot.rs
121
180
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
let mut rx = task::spawn(rx); rx.close(); assert_err!(rx.try_recv()); let _ = rx.poll(); } #[test] fn drops_tasks() { let (mut tx, mut rx) = oneshot::channel::<i32>(); let mut tx_task = task::spawn(()); let mut rx_task = task::spawn(()); assert_pending!(tx_task.enter(|cx, _| tx.poll_clo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:6
assert_eq!(2, task2.waker_ref_count()); assert_ok!(tx.send(1)); assert!(!task1.is_woken()); assert!(task2.is_woken()); assert_ready_ok!(task2.enter(|cx, _| Pin::new(&mut rx).poll(cx))); } #[test] fn sender_changes_task() { let (mut tx, rx) = oneshot::channel::<i32>(); let mut task1 = task::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_oneshot.rs
201
234
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:1
#![warn(rust_2018_idioms)] use tokio::sync::oneshot; use tokio_test::*; use std::future::Future; use std::pin::Pin; trait AssertSend: Send {} impl AssertSend for oneshot::Sender<i32> {} impl AssertSend for oneshot::Receiver<i32> {} #[test] fn send_recv() { let (tx, rx) = oneshot::channel(); let mut rx = tas...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_oneshot.rs
1
60
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:2
assert_pending!(rx.poll()); drop(tx); assert!(rx.is_woken()); assert_ready_err!(rx.poll()); } #[test] fn close_rx() { // First, without checking poll_closed() // let (tx, _) = oneshot::channel(); assert_err!(tx.send(1)); // Second, via poll_closed(); let (tx, rx) = oneshot::cha...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_oneshot.rs
41
100
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:4
assert!(tx.is_woken()); assert!(tx.is_closed()); assert_ready!(tx.enter(|cx, mut tx| tx.poll_closed(cx))); assert_ready_err!(rx.poll()); } #[test] fn explicit_close_try_recv() { // First, with message sent let (tx, mut rx) = oneshot::channel(); assert_ok!(tx.send(1)); rx.close(); le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_oneshot.rs
121
180
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:5
rx.close(); assert_err!(rx.try_recv()); let _ = rx.poll(); } #[test] fn drops_tasks() { let (mut tx, mut rx) = oneshot::channel::<i32>(); let mut tx_task = task::spawn(()); let mut rx_task = task::spawn(()); assert_pending!(tx_task.enter(|cx, _| tx.poll_closed(cx))); assert_pending!(rx_t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_oneshot.rs
161
220
tokio-rs/tokio:tokio/tests/sync_oneshot.rs:6
assert_ok!(tx.send(1)); assert!(!task1.is_woken()); assert!(task2.is_woken()); assert_ready_ok!(task2.enter(|cx, _| Pin::new(&mut rx).poll(cx))); } #[test] fn sender_changes_task() { let (mut tx, rx) = oneshot::channel::<i32>(); let mut task1 = task::spawn(()); let mut task2 = task::spawn(()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_oneshot.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_oneshot.rs
201
233
tokio-rs/tokio:tokio/tests/sync_panic.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] #![cfg(panic = "unwind")] use std::{error::Error, sync::Arc}; use tokio::{ runtime::{Builder, Runtime}, sync::{broadcast, mpsc, oneshot, Mutex, RwLock, Semaphore}, }; mod support { pub mod panic; } use support::panic::test_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_panic.rs
1
60
tokio-rs/tokio:tokio/tests/sync_panic.rs:2
Ok(()) } #[test] fn oneshot_blocking_recv_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = current_thread(); rt.block_on(async { let (_tx, rx) = oneshot::channel::<u8>(); let _ = rx.blocking_recv(); }); }); //...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_panic.rs
41
100
tokio-rs/tokio:tokio/tests/sync_panic.rs:3
// The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[test] fn rwlock_blocking_write_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = current_thread(); rt.block_on(async { let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_panic.rs
81
140
tokio-rs/tokio:tokio/tests/sync_panic.rs:4
rt.block_on(async { let _ = rx.blocking_recv(); }); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[test] fn mpsc_bounded_receiver_blocking_recv_many_panic_caller() -> Result<(), Box<dyn Error>> { let panic_locati...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_panic.rs
121
180
tokio-rs/tokio:tokio/tests/sync_panic.rs:5
Ok(()) } #[test] fn mpsc_unbounded_receiver_blocking_recv_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = current_thread(); let (_tx, mut rx) = mpsc::unbounded_channel::<u8>(); rt.block_on(async { let _ = rx.blocking_recv(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_panic.rs
161
220
tokio-rs/tokio:tokio/tests/sync_panic.rs:6
let sem2 = Arc::new(Semaphore::new(42)); let mut p1 = sem1.try_acquire_owned().unwrap(); let p2 = sem2.try_acquire_owned().unwrap(); p1.merge(p2); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[test] fn semaphore...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_panic.rs
201
231
tokio-rs/tokio:tokio/tests/sync_panic.rs:3
// The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[test] fn rwlock_blocking_write_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = current_thread(); rt.block_on(async { let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
58edfc61abe4acdc2dda485c1d66715790b9315c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/sync_panic.rs
81
140
tokio-rs/tokio:tokio/tests/sync_panic.rs:4
rt.block_on(async { let _ = rx.blocking_recv(); }); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[test] fn mpsc_bounded_sender_blocking_send_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
58edfc61abe4acdc2dda485c1d66715790b9315c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/sync_panic.rs
121
180
tokio-rs/tokio:tokio/tests/sync_panic.rs:5
Ok(()) } #[test] fn semaphore_merge_unrelated_owned_permits() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let sem1 = Arc::new(Semaphore::new(42)); let sem2 = Arc::new(Semaphore::new(42)); let mut p1 = sem1.try_acquire_owned().unwrap(); let p2 = sem2.try...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
58edfc61abe4acdc2dda485c1d66715790b9315c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/sync_panic.rs
161
198
tokio-rs/tokio:tokio/tests/sync_panic.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] use std::{error::Error, sync::Arc}; use tokio::{ runtime::{Builder, Runtime}, sync::{broadcast, mpsc, oneshot, Mutex, RwLock, Semaphore}, }; mod support { pub mod panic; } use support::panic::test_panic; #[cfg(panic = "unw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/sync_panic.rs
1
60
tokio-rs/tokio:tokio/tests/sync_panic.rs:2
Ok(()) } #[cfg(panic = "unwind")] #[test] fn oneshot_blocking_recv_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = current_thread(); rt.block_on(async { let (_tx, rx) = oneshot::channel::<u8>(); let _ = rx.blocking_recv(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/sync_panic.rs
41
100
tokio-rs/tokio:tokio/tests/sync_panic.rs:3
let lock = RwLock::<u8>::new(0); let _ = lock.blocking_read(); }); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[cfg(panic = "unwind")] #[test] fn rwlock_blocking_write_panic_caller() -> Result<(), Box<dyn Error>> {...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/sync_panic.rs
81
140
tokio-rs/tokio:tokio/tests/sync_panic.rs:4
#[cfg(panic = "unwind")] #[test] fn mpsc_bounded_receiver_blocking_recv_panic_caller() -> Result<(), Box<dyn Error>> { let panic_location_file = test_panic(|| { let rt = current_thread(); let (_tx, mut rx) = mpsc::channel::<u8>(1); rt.block_on(async { let _ = rx.blocking_recv(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/sync_panic.rs
121
180
tokio-rs/tokio:tokio/tests/sync_panic.rs:5
let (_tx, mut rx) = mpsc::unbounded_channel::<u8>(); rt.block_on(async { let _ = rx.blocking_recv(); }); }); // The panic location should be in this file assert_eq!(&panic_location_file.unwrap(), file!()); Ok(()) } #[cfg(panic = "unwind")] #[test] fn semaphore_merge_unrela...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_panic.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/sync_panic.rs
161
209