Module test_util

Source
Available on crate feature test-util only.
Expand description

Test utilities for time and sleep

Modules§

tick_advance_sleep
Test time/sleep implementations that work by manually advancing time with a tick()

Structs§

CapturedSleep
Guard returned from SleepGate::expect_sleep
ControlledSleep
A sleep implementation where calls to AsyncSleep::sleep block until SleepGate::expect_sleep is called
InstantSleep
A sleep implementation where calls to AsyncSleep::sleep will complete instantly.
ManualTimeSource
Manually controlled time source
SleepGate
Gate that allows ControlledSleep to advance.

Functions§

controlled_time_and_sleep
Returns a trio of tools to test interactions with time
instant_time_and_sleep
Returns a duo of tools to test interactions with time. Sleeps will end instantly, but the desired length of the sleeps will be recorded for later verification.