clocktest

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package clocktest provides a testable clock implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock struct {
	mock.Mock
}

Mock is a stretchr mock for a clock. In addition to implementing clock.Interface and supplying mock behavior, other methods that make mocking a bit easier are supplied.

func (*Mock) NewTicker

func (m *Mock) NewTicker(d time.Duration) clock.Ticker

func (*Mock) NewTimer

func (m *Mock) NewTimer(d time.Duration) clock.Timer

func (*Mock) Now

func (m *Mock) Now() time.Time

func (*Mock) OnNewTicker

func (m *Mock) OnNewTicker(d time.Duration, t clock.Ticker) *mock.Call

func (*Mock) OnNewTimer

func (m *Mock) OnNewTimer(d time.Duration, t clock.Timer) *mock.Call

func (*Mock) OnNow

func (m *Mock) OnNow(v time.Time) *mock.Call

func (*Mock) OnSleep

func (m *Mock) OnSleep(d time.Duration) *mock.Call

func (*Mock) Sleep

func (m *Mock) Sleep(d time.Duration)

type MockTicker

type MockTicker struct {
	mock.Mock
}

func (*MockTicker) C

func (m *MockTicker) C() <-chan time.Time

func (*MockTicker) OnC

func (m *MockTicker) OnC(c <-chan time.Time) *mock.Call

func (*MockTicker) OnStop

func (m *MockTicker) OnStop() *mock.Call

func (*MockTicker) Stop

func (m *MockTicker) Stop()

type MockTimer

type MockTimer struct {
	mock.Mock
}

MockTimer is a stretchr mock for the clock.Timer interface

func (*MockTimer) C

func (m *MockTimer) C() <-chan time.Time

func (*MockTimer) OnC

func (m *MockTimer) OnC(c <-chan time.Time) *mock.Call

func (*MockTimer) OnReset

func (m *MockTimer) OnReset(d time.Duration, r bool) *mock.Call

func (*MockTimer) OnStop

func (m *MockTimer) OnStop(r bool) *mock.Call

func (*MockTimer) Reset

func (m *MockTimer) Reset(d time.Duration) bool

func (*MockTimer) Stop

func (m *MockTimer) Stop() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL