Documentation
¶
Overview ¶
Package timex provides a Ticker abstraction with a fake implementation for deterministic, clock-injectable tests of periodic logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTimeout = errors.New("timex: wait timeout")
ErrTimeout is returned by FakeTicker.Wait when the deadline elapses first.
Functions ¶
This section is empty.
Types ¶
type FakeTicker ¶
type FakeTicker struct {
// contains filtered or unexported fields
}
FakeTicker is a manually-driven Ticker for tests.
func NewFakeTicker ¶
func NewFakeTicker() *FakeTicker
NewFakeTicker returns a FakeTicker that must be advanced with Tick.
func (*FakeTicker) Chan ¶
func (ft *FakeTicker) Chan() <-chan time.Time
Chan returns the tick channel.
func (*FakeTicker) Done ¶
func (ft *FakeTicker) Done() <-chan struct{}
Done returns a channel closed when Stop is called.
func (*FakeTicker) Stop ¶
func (ft *FakeTicker) Stop()
Stop closes the Done channel; it is safe to call multiple times.
Click to show internal directories.
Click to hide internal directories.