mock

package module
v0.0.0-...-89ca97b Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 2 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ERR_Not_Expected_Call = "not expected call of %q. Expected %q"
	ERR_Events_Is_Empty   = "not expected call of %q. Events is empty"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MockHistory

type MockHistory[T any] struct {
	// contains filtered or unexported fields
}

MockHistory stores the history of mock calls.

func NewMockHistory

func NewMockHistory[T any]() *MockHistory[T]

NewMockHistory creates a new MockHistory.

func (*MockHistory[T]) AllExpectationsDone

func (m *MockHistory[T]) AllExpectationsDone() error

AllExpectationsDone checks if all expected calls were made.

func (*MockHistory[T]) Clear

func (m *MockHistory[T]) Clear()

Clear resets the history.

func (*MockHistory[T]) Get

func (m *MockHistory[T]) Get(name string) (*MockHistoryItem[T], error)

Get retrieves a mock call from the history by name.

func (*MockHistory[T]) IsEmpty

func (m *MockHistory[T]) IsEmpty() bool

IsEmpty checks if the history is empty.

func (*MockHistory[T]) Push

func (m *MockHistory[T]) Push(name string, data T, err error)

Push adds a new mock call to the history.

type MockHistoryItem

type MockHistoryItem[T any] struct {
	Data T
	Err  error
}

Jump to

Keyboard shortcuts

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