Documentation ¶
Index ¶
- type Clock
- type Mock
- func (m *Mock) After(d time.Duration) <-chan time.Time
- func (m *Mock) SetAfterHook(h func(time.Duration) <-chan time.Time)
- func (m *Mock) Sleep(d time.Duration)
- func (m *Mock) Ticker(d time.Duration) *clock.Ticker
- func (m *Mock) Timer(d time.Duration) *clock.Timer
- func (m *Mock) TimerCh() <-chan time.Duration
- func (m *Mock) WaitForAfter(timeout time.Duration, format string, args ...any)
- func (m *Mock) WaitForAfterCh() <-chan time.Duration
- func (m *Mock) WaitForSleep(timeout time.Duration, format string, args ...any)
- func (m *Mock) WaitForTicker(timeout time.Duration, format string, args ...any)
- func (m *Mock) WaitForTickerMulti(timeout time.Duration, count int, format string, args ...any)
- func (m *Mock) WaitForTimer(timeout time.Duration, format string, args ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mock ¶
Mock is a mock clock that can be precisely controlled
func NewMockAt ¶ added in v1.6.0
NewMockAt creates a mock clock which can be precisely controlled at a specific time.
func (*Mock) After ¶
After waits for the duration to elapse and then sends the current time on the returned channel.
func (*Mock) SetAfterHook ¶ added in v1.8.3
func (*Mock) Ticker ¶
Ticker returns a new Ticker containing a channel that will send the time with a period specified by the duration argument.
func (*Mock) Timer ¶
Timer creates a new Timer containing a channel that will send the time with a period specified by the duration argument.
func (*Mock) WaitForAfter ¶
WaitForAfter waits up to the specified timeout for After to be called on the clock.
func (*Mock) WaitForAfterCh ¶ added in v1.4.2
func (*Mock) WaitForSleep ¶
WaitForSleep waits up to the specified timeout for a sleep to begin using the clock.
func (*Mock) WaitForTicker ¶
WaitForTicker waits up to the specified timeout for a Ticker to be created from the clock.