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_semaphore.rs:1
#![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; use std::sync::Arc; use tokio::sync::Semaphore; #[test] fn no_permits() { // this should not panic Semaphore::new(0); } #[test] fn try_acquire() { let sem = Semaphore::new(1); { let p1 ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_semaphore.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore.rs:1
#![cfg(feature = "full")] use std::sync::Arc; use tokio::sync::Semaphore; #[test] fn no_permits() { // this should not panic Semaphore::new(0); } #[test] fn try_acquire() { let sem = Semaphore::new(1); { let p1 = sem.try_acquire(); assert!(p1.is_ok()); let p2 = sem.try_acquire...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
a6051a61ec5c96113f4b543de3ec55431695347a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a6051a61ec5c96113f4b543de3ec55431695347a/tokio/tests/sync_semaphore.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore.rs:2
let j = tokio::spawn(async move { let _p2 = sem_clone.acquire().await; }); sem.add_permits(1); j.await.unwrap(); } #[test] fn forget() { let sem = Arc::new(Semaphore::new(1)); { let p = sem.try_acquire().unwrap(); assert_eq!(sem.available_permits(), 0); p.forget(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
a6051a61ec5c96113f4b543de3ec55431695347a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a6051a61ec5c96113f4b543de3ec55431695347a/tokio/tests/sync_semaphore.rs
41
95
tokio-rs/tokio:tokio/tests/sync_semaphore.rs:3
} #[test] fn add_max_amount_permits() { let s = tokio::sync::Semaphore::new(0); s.add_permits(usize::MAX >> 3); assert_eq!(s.available_permits(), usize::MAX >> 3); } #[test] #[should_panic] fn add_more_than_max_amount_permits() { let s = tokio::sync::Semaphore::new(1); s.add_permits(usize::MAX >> ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
a6051a61ec5c96113f4b543de3ec55431695347a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a6051a61ec5c96113f4b543de3ec55431695347a/tokio/tests/sync_semaphore.rs
81
95
tokio-rs/tokio:tokio/tests/sync_semaphore.rs:2
let j = tokio::spawn(async move { let _p2 = sem_clone.acquire().await; }); sem.add_permits(1); j.await.unwrap(); } #[test] fn forget() { let sem = Arc::new(Semaphore::new(1)); { let p = sem.try_acquire().unwrap(); assert_eq!(sem.available_permits(), 0); p.forget(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
9211adbe01661585cd1831214279262024d04816
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9211adbe01661585cd1831214279262024d04816/tokio/tests/sync_semaphore.rs
41
81
tokio-rs/tokio:tokio/tests/sync_semaphore.rs:1
#![warn(rust_2018_idioms)] use tokio::sync::semaphore::{Permit, Semaphore}; use tokio_test::task; use tokio_test::{assert_pending, assert_ready_err, assert_ready_ok}; #[test] fn available_permits() { let s = Semaphore::new(100); assert_eq!(s.available_permits(), 100); // Polling for a permit succeeds imm...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_semaphore.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore.rs:2
permit_1.release(&s); assert_eq!(s.available_permits(), 0); assert!(permit_2.is_woken()); assert_ready_ok!(permit_2.enter(|cx, mut p| p.poll_acquire(cx, &s))); permit_2.release(&s); assert_eq!(s.available_permits(), 1); } #[test] fn zero_permits() { let s = Semaphore::new(0); assert_eq!(s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_semaphore.rs
41
100
tokio-rs/tokio:tokio/tests/sync_semaphore.rs:3
assert_eq!(1, s.available_permits()); let mut permit = task::spawn(Permit::new()); assert_ready_err!(permit.enter(|cx, mut p| p.poll_acquire(cx, &s))); assert_eq!(1, s.available_permits()); } #[test] fn close_semaphore_notifies_permit1() { let s = Semaphore::new(0); let mut permit = task::spawn(P...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_semaphore.rs
81
138
tokio-rs/tokio:tokio/tests/sync_semaphore.rs:4
assert!(permit3.is_woken()); assert!(permit4.is_woken()); assert_ready_err!(permit3.enter(|cx, mut p| p.poll_acquire(cx, &s))); assert_ready_err!(permit4.enter(|cx, mut p| p.poll_acquire(cx, &s))); assert_eq!(0, s.available_permits()); permit1.release(&s); assert_eq!(1, s.available_permits()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/sync_semaphore.rs
121
138
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:1
#![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use std::sync::Arc; use tokio::sync::Semaphore; #[test] fn try_acquire() { let sem = Arc::new(Semaphore::new(1)); { let p1 = sem.clone().try_acquire_owned(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_semaphore_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:2
let sem = Arc::new(Semaphore::new(1)); let p1 = sem.clone().try_acquire_owned().unwrap(); let sem_clone = sem.clone(); let j = tokio::spawn(async move { let _p2 = sem_clone.acquire_owned().await; }); drop(p1); j.await.unwrap(); } #[tokio::test] #[cfg(feature = "full")] async fn acquire_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_semaphore_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:3
let sem = Arc::new(Semaphore::new(1)); { let p = sem.clone().try_acquire_owned().unwrap(); assert_eq!(sem.available_permits(), 0); p.forget(); assert_eq!(sem.available_permits(), 0); } assert_eq!(sem.available_permits(), 0); assert!(sem.try_acquire_owned().is_err()); } #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_semaphore_owned.rs
81
140
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:4
assert_eq!(sem.available_permits(), 2); assert_eq!(p1.num_permits(), 3); let mut p2 = p1.split(1).unwrap(); assert_eq!(sem.available_permits(), 2); assert_eq!(p1.num_permits(), 2); assert_eq!(p2.num_permits(), 1); let p3 = p1.split(0).unwrap(); assert_eq!(p3.num_permits(), 0); drop(p1); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_semaphore_owned.rs
121
164
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:3
let sem = Arc::new(Semaphore::new(1)); { let p = sem.clone().try_acquire_owned().unwrap(); assert_eq!(sem.available_permits(), 0); p.forget(); assert_eq!(sem.available_permits(), 0); } assert_eq!(sem.available_permits(), 0); assert!(sem.try_acquire_owned().is_err()); } #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_semaphore_owned.rs
81
138
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:4
let mut join_handles = Vec::new(); for _ in 0..1000 { let sem_clone = sem.clone(); join_handles.push(tokio::spawn(async move { let _p = sem_clone.acquire_owned().await; })); } for j in join_handles { j.await.unwrap(); } // there should be exactly 5 semapho...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_semaphore_owned.rs
121
138
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:1
#![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; use std::sync::Arc; use tokio::sync::Semaphore; #[test] fn try_acquire() { let sem = Arc::new(Semaphore::new(1)); { let p1 = sem.clone().try_acquire_owned(); assert!(p1.is_ok()); le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
909de088450a31d1c472adc44532dca4910765b2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909de088450a31d1c472adc44532dca4910765b2/tokio/tests/sync_semaphore_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:3
let sem = Arc::new(Semaphore::new(1)); { let p = sem.clone().try_acquire_owned().unwrap(); assert_eq!(sem.available_permits(), 0); p.forget(); assert_eq!(sem.available_permits(), 0); } assert_eq!(sem.available_permits(), 0); assert!(sem.try_acquire_owned().is_err()); } #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
909de088450a31d1c472adc44532dca4910765b2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/909de088450a31d1c472adc44532dca4910765b2/tokio/tests/sync_semaphore_owned.rs
81
138
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:2
let sem = Arc::new(Semaphore::new(1)); let p1 = sem.clone().try_acquire_owned().unwrap(); let sem_clone = sem.clone(); let j = tokio::spawn(async move { let _p2 = sem_clone.acquire_owned().await; }); drop(p1); j.await.unwrap(); } #[tokio::test] #[cfg(feature = "full")] async fn acquire_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_semaphore_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:3
let sem = Arc::new(Semaphore::new(1)); { let p = sem.clone().try_acquire_owned().unwrap(); assert_eq!(sem.available_permits(), 0); p.forget(); assert_eq!(sem.available_permits(), 0); } assert_eq!(sem.available_permits(), 0); assert!(sem.try_acquire_owned().is_err()); } #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_semaphore_owned.rs
81
113
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:1
#![cfg(feature = "sync")] #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use std::sync::Arc; use tokio::sync::Semaphore; #[test] fn try_acquire() { let sem = Arc::new(Semaphore::new(1)); { let p1 = sem.clone().try_acquire_owned(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
f3e340a35b306e926e78537a0dd65b2e9b9cdc89
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f3e340a35b306e926e78537a0dd65b2e9b9cdc89/tokio/tests/sync_semaphore_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:2
let sem = Arc::new(Semaphore::new(1)); let p1 = sem.clone().try_acquire_owned().unwrap(); let sem_clone = sem.clone(); let j = tokio::spawn(async move { let _p2 = sem_clone.acquire_owned().await; }); drop(p1); j.await.unwrap(); } #[tokio::test] #[cfg(feature = "full")] async fn acquire_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_semaphore_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:3
let sem = Arc::new(Semaphore::new(1)); { let p = sem.clone().try_acquire_owned().unwrap(); assert_eq!(sem.available_permits(), 0); p.forget(); assert_eq!(sem.available_permits(), 0); } assert_eq!(sem.available_permits(), 0); assert!(sem.try_acquire_owned().is_err()); } #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_semaphore_owned.rs
81
113
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:1
#![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; use std::sync::Arc; use tokio::sync::Semaphore; #[test] fn try_acquire() { let sem = Arc::new(Semaphore::new(1)); { let p1 = sem.clone().try_acquire_owned(); assert!(p1.is_ok()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_semaphore_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:1
#![cfg(feature = "full")] use std::sync::Arc; use tokio::sync::Semaphore; #[test] fn try_acquire() { let sem = Arc::new(Semaphore::new(1)); { let p1 = sem.clone().try_acquire_owned(); assert!(p1.is_ok()); let p2 = sem.clone().try_acquire_owned(); assert!(p2.is_err()); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
fc23f8a1a50aa4a3df47cf81d3ae51213b7e6d71
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fc23f8a1a50aa4a3df47cf81d3ae51213b7e6d71/tokio/tests/sync_semaphore_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:2
let _p2 = sem_clone.acquire_owned().await; }); drop(p1); j.await.unwrap(); } #[tokio::test] async fn acquire_many() { let semaphore = Arc::new(Semaphore::new(42)); let permit32 = semaphore.clone().try_acquire_many_owned(32).unwrap(); let (sender, receiver) = tokio::sync::oneshot::channel(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
fc23f8a1a50aa4a3df47cf81d3ae51213b7e6d71
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fc23f8a1a50aa4a3df47cf81d3ae51213b7e6d71/tokio/tests/sync_semaphore_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:3
} assert_eq!(sem.available_permits(), 0); assert!(sem.try_acquire_owned().is_err()); } #[tokio::test] async fn stresstest() { let sem = Arc::new(Semaphore::new(5)); let mut join_handles = Vec::new(); for _ in 0..1000 { let sem_clone = sem.clone(); join_handles.push(tokio::spawn(asyn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
fc23f8a1a50aa4a3df47cf81d3ae51213b7e6d71
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fc23f8a1a50aa4a3df47cf81d3ae51213b7e6d71/tokio/tests/sync_semaphore_owned.rs
81
106
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:1
#![cfg(feature = "full")] use std::sync::Arc; use tokio::sync::Semaphore; #[test] fn try_acquire() { let sem = Arc::new(Semaphore::new(1)); { let p1 = sem.clone().try_acquire_owned(); assert!(p1.is_ok()); let p2 = sem.clone().try_acquire_owned(); assert!(p2.is_err()); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
5a548044d7bfd5d1c59d1a398d34ccbc29cbfe70
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5a548044d7bfd5d1c59d1a398d34ccbc29cbfe70/tokio/tests/sync_semaphore_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_semaphore_owned.rs:2
#[test] fn forget() { let sem = Arc::new(Semaphore::new(1)); { let p = sem.clone().try_acquire_owned().unwrap(); assert_eq!(sem.available_permits(), 0); p.forget(); assert_eq!(sem.available_permits(), 0); } assert_eq!(sem.available_permits(), 0); assert!(sem.try_acqui...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_semaphore_owned.rs
MIT
5a548044d7bfd5d1c59d1a398d34ccbc29cbfe70
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5a548044d7bfd5d1c59d1a398d34ccbc29cbfe70/tokio/tests/sync_semaphore_owned.rs
41
75
tokio-rs/tokio:tokio/tests/sync_set_once.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::sync::{ atomic::{AtomicU32, Ordering}, Arc, }; use tokio::sync::SetOnce; #[derive(Clone)] struct DropCounter { drops: Arc<AtomicU32>, } impl DropCounter { fn new() -> Self { DropCounter { drops: Arc::new(AtomicU32::new(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_set_once.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_set_once.rs
1
60
tokio-rs/tokio:tokio/tests/sync_set_once.rs:2
assert!(prev.is_ok()) } fooer.assert_num_drops(1); } #[test] fn drop_cell_new_with() { let fooer = DropCounter::new(); { let once_cell = SetOnce::new_with(Some(fooer.clone())); assert!(once_cell.initialized()); } fooer.assert_num_drops(1); } #[test] fn drop_into_inner() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_set_once.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_set_once.rs
41
100
tokio-rs/tokio:tokio/tests/sync_set_once.rs:3
#[test] fn from() { let cell = SetOnce::from(2); assert_eq!(*cell.get().unwrap(), 2); } #[test] fn set_and_get() { static ONCE: SetOnce<u32> = SetOnce::const_new(); ONCE.set(5).unwrap(); let value = ONCE.get().unwrap(); assert_eq!(*value, 5); } #[tokio::test] async fn set_and_wait() { sta...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_set_once.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_set_once.rs
81
140
tokio-rs/tokio:tokio/tests/sync_set_once.rs:4
#[tokio::test] #[cfg_attr(target_family = "wasm", ignore)] async fn set_and_wait_threads() { static ONCE: SetOnce<u32> = SetOnce::const_new(); let thread = std::thread::spawn(|| { ONCE.set(4).unwrap(); }); let value = ONCE.wait().await; thread.join().unwrap(); assert_eq!(*value, 4); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_set_once.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_set_once.rs
121
180
tokio-rs/tokio:tokio/tests/sync_set_once.rs:5
assert!(ONCE.set(10).is_err()); } #[tokio::test] async fn is_some_initializing() { static ONCE: SetOnce<u32> = SetOnce::const_new(); tokio::spawn(async { ONCE.set(20) }); assert_eq!(*ONCE.wait().await, 20); } #[test] fn into_inner_int_empty_setonce() { let once = SetOnce::<u32>::new(); let val ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_set_once.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_set_once.rs
161
180
tokio-rs/tokio:tokio/tests/sync_watch.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::watch; use tokio_test::task::spawn; use tokio_test::{ assert_pending, assert_ready, assert_re...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
drop(tx); assert!(t.is_woken()); assert_ready_err!(t.poll()); } assert_eq!(*rx.borrow(), "two"); } #[test] fn rx_version_underflow() { let (_tx, mut rx) = watch::channel("one"); // Version starts at 2, validate we do not underflow rx.mark_changed(); rx.mark_changed(); } #[tes...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
rx3.mark_changed(); assert_eq!(*rx3.borrow(), "one"); assert!(rx3.has_changed().unwrap()); assert_eq!(*rx3.borrow_and_update(), "one"); assert!(!rx3.has_changed().unwrap()); let mut t = spawn(rx3.changed()); assert_pending!(t.poll()); } { tx.send("two...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
let mut t = spawn(rx.changed()); assert_pending!(t.poll()); } { assert!(!rx2.has_changed().unwrap()); tx.send("two").unwrap(); assert!(rx2.has_changed().unwrap()); rx2.mark_unchanged(); assert!(!rx2.has_changed().unwrap()); assert_eq!(*rx2.borrow_and_up...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
assert_pending!(t2.poll()); tx.send("two").unwrap(); assert!(t1.is_woken()); assert!(t2.is_woken()); assert_ready_ok!(t1.poll()); } assert_eq!(*rx1.borrow(), "two"); { let mut t1 = spawn(rx1.changed()); assert_pending!(t1.poll()); tx.send("three"...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
assert_ready_ok!(t2.poll()); } assert_eq!(*rx1.borrow(), "four"); assert_eq!(*rx2.borrow(), "four"); } #[test] fn rx_observes_final_value() { // Initial value let (tx, mut rx) = watch::channel("one"); drop(tx); { let mut t1 = spawn(rx.changed()); assert_ready_err!(t1.poll(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
201
260
tokio-rs/tokio:tokio/tests/sync_watch.rs:7
assert_ready_ok!(t1.poll()); } assert_eq!(*rx.borrow(), "three"); { let mut t1 = spawn(rx.changed()); assert_ready_err!(t1.poll()); } assert_eq!(*rx.borrow(), "three"); } #[test] fn poll_close() { let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
241
300
tokio-rs/tokio:tokio/tests/sync_watch.rs:8
tx.send("three").unwrap(); assert!(rx.has_changed().unwrap()); assert_eq!(*rx.borrow_and_update(), "three"); assert_pending!(spawn(rx.changed()).poll()); assert!(!rx.has_changed().unwrap()); drop(tx); assert_eq!(*rx.borrow_and_update(), "three"); assert_ready!(spawn(rx.changed()).poll()).un...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
281
340
tokio-rs/tokio:tokio/tests/sync_watch.rs:9
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { tx.send_modify(|old| { *old = "panicked"; panic!(); }) })); assert!(result.is_err()); assert_pending!(task.poll()); assert_eq!(*rx.borrow(), "panicked"); tx.send_modify(|old| *old = "thr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
321
380
tokio-rs/tokio:tokio/tests/sync_watch.rs:10
let mut t = spawn(rx.changed()); assert_pending!(t.poll()); drop(tx1); assert!(!t.is_woken()); drop(tx2); assert!(t.is_woken()); } #[tokio::test] async fn receiver_changed_is_cooperative() { let (tx, mut rx) = watch::channel(()); drop(tx); tokio::select! { biased; _ ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
361
420
tokio-rs/tokio:tokio/tests/sync_watch.rs:11
_ = tokio::task::yield_now() => {}, } } #[tokio::test] async fn receiver_wait_for_is_cooperative() { let (tx, mut rx) = watch::channel(0); drop(tx); tokio::select! { biased; _ = async { loop { assert!(rx.wait_for(|val| *val == 1).await.is_err()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
401
460
tokio-rs/tokio:tokio/tests/sync_watch.rs:12
drop(rx); tokio::select! { _ = async { loop { tx.closed().await; } } => {}, _ = tokio::task::yield_now() => {}, } } #[tokio::test] async fn changed_succeeds_on_closed_channel_with_unseen_value() { let (tx, mut rx) = watch::channel("A"); t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
441
500
tokio-rs/tokio:tokio/tests/sync_watch.rs:13
drop(tx); rx.has_changed() .expect_err("`has_changed` returns an error if and only if channel is closed. Even if the current value is not seen."); } #[test] fn has_changed_errors_on_closed_channel_with_seen_value() { let (tx, rx) = watch::channel("A"); drop(tx); rx.has_changed() .expe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_watch.rs
481
505
tokio-rs/tokio:tokio/tests/sync_watch.rs:11
_ = tokio::task::yield_now() => {}, } } #[tokio::test] async fn receiver_wait_for_is_cooperative() { let (tx, mut rx) = watch::channel(0); drop(tx); tokio::select! { biased; _ = async { loop { assert!(rx.wait_for(|val| *val == 1).await.is_err()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c8af499990d739f4e849bf33c1e1fa4b353f5958
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c8af499990d739f4e849bf33c1e1fa4b353f5958/tokio/tests/sync_watch.rs
401
452
tokio-rs/tokio:tokio/tests/sync_watch.rs:12
drop(rx); tokio::select! { _ = async { loop { tx.closed().await; } } => {}, _ = tokio::task::yield_now() => {}, } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c8af499990d739f4e849bf33c1e1fa4b353f5958
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c8af499990d739f4e849bf33c1e1fa4b353f5958/tokio/tests/sync_watch.rs
441
452
tokio-rs/tokio:tokio/tests/sync_watch.rs:9
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { tx.send_modify(|old| { *old = "panicked"; panic!(); }) })); assert!(result.is_err()); assert_pending!(task.poll()); assert_eq!(*rx.borrow(), "panicked"); tx.send_modify(|old| *old = "thr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
f71bded94361323e9bddd52f3d13559887e76884
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f71bded94361323e9bddd52f3d13559887e76884/tokio/tests/sync_watch.rs
321
370
tokio-rs/tokio:tokio/tests/sync_watch.rs:10
let mut t = spawn(rx.changed()); assert_pending!(t.poll()); drop(tx1); assert!(!t.is_woken()); drop(tx2); assert!(t.is_woken()); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
f71bded94361323e9bddd52f3d13559887e76884
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f71bded94361323e9bddd52f3d13559887e76884/tokio/tests/sync_watch.rs
361
370
tokio-rs/tokio:tokio/tests/sync_watch.rs:9
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { tx.send_modify(|old| { *old = "panicked"; panic!(); }) })); assert!(result.is_err()); assert_pending!(task.poll()); assert_eq!(*rx.borrow(), "panicked"); tx.send_modify(|old| *old = "thr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
a3d2548789d22d4bf193a4614f229944270e912c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a3d2548789d22d4bf193a4614f229944270e912c/tokio/tests/sync_watch.rs
321
370
tokio-rs/tokio:tokio/tests/sync_watch.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::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready, assert_ready_e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
assert!(t.is_woken()); assert_ready_err!(t.poll()); } assert_eq!(*rx.borrow(), "two"); } #[test] fn rx_version_underflow() { let (_tx, mut rx) = watch::channel("one"); // Version starts at 2, validate we do not underflow rx.mark_changed(); rx.mark_changed(); } #[test] fn rx_mark_chang...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
assert!(rx3.has_changed().unwrap()); assert_eq!(*rx3.borrow_and_update(), "one"); assert!(!rx3.has_changed().unwrap()); let mut t = spawn(rx3.changed()); assert_pending!(t.poll()); } { tx.send("two").unwrap(); assert!(rx4.has_changed().unwrap()); asser...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
assert_pending!(t.poll()); } { assert!(!rx2.has_changed().unwrap()); tx.send("two").unwrap(); assert!(rx2.has_changed().unwrap()); rx2.mark_unchanged(); assert!(!rx2.has_changed().unwrap()); assert_eq!(*rx2.borrow_and_update(), "two"); } assert_eq!(*rx...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
tx.send("two").unwrap(); assert!(t1.is_woken()); assert!(t2.is_woken()); assert_ready_ok!(t1.poll()); } assert_eq!(*rx1.borrow(), "two"); { let mut t1 = spawn(rx1.changed()); assert_pending!(t1.poll()); tx.send("three").unwrap(); assert!(t1.is_wo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
assert_eq!(*rx1.borrow(), "four"); assert_eq!(*rx2.borrow(), "four"); } #[test] fn rx_observes_final_value() { // Initial value let (tx, mut rx) = watch::channel("one"); drop(tx); { let mut t1 = spawn(rx.changed()); assert_ready_err!(t1.poll()); } assert_eq!(*rx.borrow(), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
201
260
tokio-rs/tokio:tokio/tests/sync_watch.rs:7
assert_eq!(*rx.borrow(), "three"); { let mut t1 = spawn(rx.changed()); assert_ready_err!(t1.poll()); } assert_eq!(*rx.borrow(), "three"); } #[test] fn poll_close() { let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed()); assert_pending!(t.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
241
300
tokio-rs/tokio:tokio/tests/sync_watch.rs:8
assert_eq!(*rx.borrow_and_update(), "three"); assert_pending!(spawn(rx.changed()).poll()); assert!(!rx.has_changed().unwrap()); drop(tx); assert_eq!(*rx.borrow_and_update(), "three"); assert_ready!(spawn(rx.changed()).poll()).unwrap_err(); assert!(rx.has_changed().is_err()); } #[test] fn reope...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
281
334
tokio-rs/tokio:tokio/tests/sync_watch.rs:9
tx.send_modify(|old| { *old = "panicked"; panic!(); }) })); assert!(result.is_err()); assert_pending!(task.poll()); assert_eq!(*rx.borrow(), "panicked"); tx.send_modify(|old| *old = "three"); assert_ready_ok!(task.poll()); assert_eq!(*rx.borrow_and_update(),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/02b779e315c5c5f0dbbc8b56fc711cc8e665ee1e/tokio/tests/sync_watch.rs
321
334
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
assert!(rx3.has_changed().unwrap()); assert_eq!(*rx3.borrow_and_update(), "one"); assert!(!rx3.has_changed().unwrap()); let mut t = spawn(rx3.changed()); assert_pending!(t.poll()); } { tx.send("two").unwrap(); assert!(rx4.has_changed().unwrap()); asser...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
804511822b4be12a958d01fe1156b0a71bc8e6f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/804511822b4be12a958d01fe1156b0a71bc8e6f7/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
{ let mut t1 = spawn(rx1.changed()); assert_pending!(t1.poll()); assert_pending!(t2.poll()); tx.send("two").unwrap(); assert!(t1.is_woken()); assert!(t2.is_woken()); assert_ready_ok!(t1.poll()); } assert_eq!(*rx1.borrow(), "two"); { let mu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
804511822b4be12a958d01fe1156b0a71bc8e6f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/804511822b4be12a958d01fe1156b0a71bc8e6f7/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
assert_pending!(t2.poll()); tx.send("four").unwrap(); assert_ready_ok!(t1.poll()); assert_ready_ok!(t2.poll()); } assert_eq!(*rx1.borrow(), "four"); assert_eq!(*rx2.borrow(), "four"); } #[test] fn rx_observes_final_value() { // Initial value let (tx, mut rx) = watch::chan...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
804511822b4be12a958d01fe1156b0a71bc8e6f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/804511822b4be12a958d01fe1156b0a71bc8e6f7/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
tx.send("three").unwrap(); drop(tx); assert!(t1.is_woken()); assert_ready_ok!(t1.poll()); } assert_eq!(*rx.borrow(), "three"); { let mut t1 = spawn(rx.changed()); assert_ready_err!(t1.poll()); } assert_eq!(*rx.borrow(), "three"); } #[test] fn poll_close() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
804511822b4be12a958d01fe1156b0a71bc8e6f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/804511822b4be12a958d01fe1156b0a71bc8e6f7/tokio/tests/sync_watch.rs
201
260
tokio-rs/tokio:tokio/tests/sync_watch.rs:7
assert!(rx.has_changed().unwrap()); assert_ready!(spawn(rx.changed()).poll()).unwrap(); assert_pending!(spawn(rx.changed()).poll()); assert!(!rx.has_changed().unwrap()); tx.send("three").unwrap(); assert!(rx.has_changed().unwrap()); assert_eq!(*rx.borrow_and_update(), "three"); assert_pendi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
804511822b4be12a958d01fe1156b0a71bc8e6f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/804511822b4be12a958d01fe1156b0a71bc8e6f7/tokio/tests/sync_watch.rs
241
300
tokio-rs/tokio:tokio/tests/sync_watch.rs:8
let mut rx2 = rx.clone(); assert_eq!(*rx2.borrow_and_update(), "two"); let mut task = spawn(rx2.changed()); let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { tx.send_modify(|old| { *old = "panicked"; panic!(); }) })); assert!(result.is_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
804511822b4be12a958d01fe1156b0a71bc8e6f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/804511822b4be12a958d01fe1156b0a71bc8e6f7/tokio/tests/sync_watch.rs
281
301
tokio-rs/tokio:tokio/tests/sync_watch.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::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready, assert_ready_e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
61042b4d90fa737dcf922e01466ded812c0f1a03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/61042b4d90fa737dcf922e01466ded812c0f1a03/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
assert!(t.is_woken()); assert_ready_err!(t.poll()); } assert_eq!(*rx.borrow(), "two"); } #[test] fn rx_version_underflow() { let (_tx, mut rx) = watch::channel("one"); // Version starts at 2, validate we do not underflow rx.mark_unseen(); rx.mark_unseen(); } #[test] fn rx_mark_unseen(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
61042b4d90fa737dcf922e01466ded812c0f1a03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/61042b4d90fa737dcf922e01466ded812c0f1a03/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
assert!(rx3.has_changed().unwrap()); assert_eq!(*rx3.borrow_and_update(), "one"); assert!(!rx3.has_changed().unwrap()); let mut t = spawn(rx3.changed()); assert_pending!(t.poll()); } { tx.send("two").unwrap(); assert!(rx4.has_changed().unwrap()); asser...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
61042b4d90fa737dcf922e01466ded812c0f1a03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/61042b4d90fa737dcf922e01466ded812c0f1a03/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.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::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready, assert_ready_e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
assert!(t.is_woken()); assert_ready_err!(t.poll()); } assert_eq!(*rx.borrow(), "two"); } #[test] fn multi_rx() { let (tx, mut rx1) = watch::channel("one"); let mut rx2 = rx1.clone(); { let mut t1 = spawn(rx1.changed()); let mut t2 = spawn(rx2.changed()); assert_pen...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
assert_pending!(t1.poll()); tx.send("three").unwrap(); assert!(t1.is_woken()); assert!(t2.is_woken()); assert_ready_ok!(t1.poll()); assert_ready_ok!(t2.poll()); } assert_eq!(*rx1.borrow(), "three"); drop(t2); assert_eq!(*rx2.borrow(), "three"); { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
{ let mut t1 = spawn(rx.changed()); assert_ready_err!(t1.poll()); } assert_eq!(*rx.borrow(), "one"); // Sending a value let (tx, mut rx) = watch::channel("one"); tx.send("two").unwrap(); { let mut t1 = spawn(rx.changed()); assert_ready_ok!(t1.poll()); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::chann...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
fn reopened_after_subscribe() { let (tx, rx) = watch::channel("one"); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); let rx = tx.subscribe(); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); } #[test] #[cfg(panic = "unwind")] #[cfg(not(target_family = "wasm"...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_watch.rs
201
243
tokio-rs/tokio:tokio/tests/sync_watch.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok}; #[test] fn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c90757f07a1b15d7e26a710003d8e98a83db1ffc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c90757f07a1b15d7e26a710003d8e98a83db1ffc/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::chann...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c90757f07a1b15d7e26a710003d8e98a83db1ffc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c90757f07a1b15d7e26a710003d8e98a83db1ffc/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
fn reopened_after_subscribe() { let (tx, rx) = watch::channel("one"); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); let rx = tx.subscribe(); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); } #[test] #[cfg(panic = "unwind")] #[cfg(not(tokio_wasm))] // wasm ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c90757f07a1b15d7e26a710003d8e98a83db1ffc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c90757f07a1b15d7e26a710003d8e98a83db1ffc/tokio/tests/sync_watch.rs
201
243
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::chann...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
fn reopened_after_subscribe() { let (tx, rx) = watch::channel("one"); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); let rx = tx.subscribe(); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); } #[test] #[cfg(not(tokio_wasm))] // wasm currently doesn't support...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_watch.rs
201
242
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::chann...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
fn reopened_after_subscribe() { let (tx, rx) = watch::channel("one"); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); let rx = tx.subscribe(); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); } #[test] #[cfg(not(target_family = "wasm"))] // wasm currently doe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/sync_watch.rs
201
242
tokio-rs/tokio:tokio/tests/sync_watch.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready, assert_ready_e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::chann...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
fn reopened_after_subscribe() { let (tx, rx) = watch::channel("one"); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); let rx = tx.subscribe(); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); } #[test] #[cfg(not(target_arch = "wasm32"))] // wasm currently doe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_watch.rs
201
242
tokio-rs/tokio:tokio/tests/sync_watch.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok}; #[test]...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
ff8befbc549ef6a83db5879953e087a988e7e94c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff8befbc549ef6a83db5879953e087a988e7e94c/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::chann...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
067ddff0635fe3b7edc9831167f7804de9891cf8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/067ddff0635fe3b7edc9831167f7804de9891cf8/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
fn reopened_after_subscribe() { let (tx, rx) = watch::channel("one"); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); let rx = tx.subscribe(); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); } #[test] fn send_modify_panic() { let (tx, mut rx) = watch::ch...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
067ddff0635fe3b7edc9831167f7804de9891cf8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/067ddff0635fe3b7edc9831167f7804de9891cf8/tokio/tests/sync_watch.rs
201
241
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let (tx, rx) = watch::channel("one"); { let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::chann...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_watch.rs
161
213
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
fn reopened_after_subscribe() { let (tx, rx) = watch::channel("one"); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); let rx = tx.subscribe(); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_watch.rs
201
213
tokio-rs/tokio:tokio/tests/sync_watch.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok}; #[test] fn single_rx_recv() { let (tx, mut rx) = watch::channel("one"); { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
12dd06336d2af8c2d735d4d9e3dc0454ad7942a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12dd06336d2af8c2d735d4d9e3dc0454ad7942a0/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
assert_eq!(*rx.borrow(), "two"); } #[test] fn multi_rx() { let (tx, mut rx1) = watch::channel("one"); let mut rx2 = rx1.clone(); { let mut t1 = spawn(rx1.changed()); let mut t2 = spawn(rx2.changed()); assert_pending!(t1.poll()); assert_pending!(t2.poll()); } assert...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
12dd06336d2af8c2d735d4d9e3dc0454ad7942a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12dd06336d2af8c2d735d4d9e3dc0454ad7942a0/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
tx.send("three").unwrap(); assert!(t1.is_woken()); assert!(t2.is_woken()); assert_ready_ok!(t1.poll()); assert_ready_ok!(t2.poll()); } assert_eq!(*rx1.borrow(), "three"); drop(t2); assert_eq!(*rx2.borrow(), "three"); { let mut t1 = spawn(rx1.changed()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
12dd06336d2af8c2d735d4d9e3dc0454ad7942a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12dd06336d2af8c2d735d4d9e3dc0454ad7942a0/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
} assert_eq!(*rx.borrow(), "one"); // Sending a value let (tx, mut rx) = watch::channel("one"); tx.send("two").unwrap(); { let mut t1 = spawn(rx.changed()); assert_ready_ok!(t1.poll()); } assert_eq!(*rx.borrow(), "two"); { let mut t1 = spawn(rx.changed()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
12dd06336d2af8c2d735d4d9e3dc0454ad7942a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12dd06336d2af8c2d735d4d9e3dc0454ad7942a0/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::channel("one"); assert!(!rx.has_changed().unwrap()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
12dd06336d2af8c2d735d4d9e3dc0454ad7942a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12dd06336d2af8c2d735d4d9e3dc0454ad7942a0/tokio/tests/sync_watch.rs
161
210
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
drop(rx); assert!(tx.is_closed()); let rx = tx.subscribe(); assert!(!tx.is_closed()); drop(rx); assert!(tx.is_closed()); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
12dd06336d2af8c2d735d4d9e3dc0454ad7942a0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12dd06336d2af8c2d735d4d9e3dc0454ad7942a0/tokio/tests/sync_watch.rs
201
210
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
} assert_eq!(*rx.borrow(), "one"); // Sending a value let (tx, mut rx) = watch::channel("one"); tx.send("two").unwrap(); { let mut t1 = spawn(rx.changed()); assert_ready_ok!(t1.poll()); } assert_eq!(*rx.borrow(), "two"); { let mut t1 = spawn(rx.changed()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
8aa2bfe23e739b19a0787ab141d2965d9e891997
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8aa2bfe23e739b19a0787ab141d2965d9e891997/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::channel("one"); tx.send("two").unwrap(); assert_r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
8aa2bfe23e739b19a0787ab141d2965d9e891997
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8aa2bfe23e739b19a0787ab141d2965d9e891997/tokio/tests/sync_watch.rs
161
203
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); } #[test] fn borrow_and_update() { let (tx, mut rx) = watch::channel("one"); tx.send("two").unwrap(); assert_r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
c8ecfc894d06db466fe14b90f8b7f64eb3a3d5ea
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c8ecfc894d06db466fe14b90f8b7f64eb3a3d5ea/tokio/tests/sync_watch.rs
161
188
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
} assert_eq!(*rx.borrow(), "one"); // Sending a value let (tx, mut rx) = watch::channel("one"); tx.send("two").unwrap(); { let mut t1 = spawn(rx.changed()); assert_ready_ok!(t1.poll()); } assert_eq!(*rx.borrow(), "two"); { let mut t1 = spawn(rx.changed()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
2bc9a4815259c8ff4daa5e24f128ec826970d17f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bc9a4815259c8ff4daa5e24f128ec826970d17f/tokio/tests/sync_watch.rs
121
171