diff options
Diffstat (limited to 'library/core/tests/task.rs')
-rw-r--r-- | library/core/tests/task.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/library/core/tests/task.rs b/library/core/tests/task.rs index d71fef9e5..56be30e92 100644 --- a/library/core/tests/task.rs +++ b/library/core/tests/task.rs @@ -1,4 +1,4 @@ -use core::task::Poll; +use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; #[test] fn poll_const() { @@ -12,3 +12,18 @@ fn poll_const() { const IS_PENDING: bool = POLL.is_pending(); assert!(IS_PENDING); } + +#[test] +fn waker_const() { + const VOID_TABLE: RawWakerVTable = RawWakerVTable::new(|_| VOID_WAKER, |_| {}, |_| {}, |_| {}); + + const VOID_WAKER: RawWaker = RawWaker::new(&(), &VOID_TABLE); + + static WAKER: Waker = unsafe { Waker::from_raw(VOID_WAKER) }; + + static CONTEXT: Context<'static> = Context::from_waker(&WAKER); + + static WAKER_REF: &'static Waker = CONTEXT.waker(); + + WAKER_REF.wake_by_ref(); +} |