Documentation ¶
Index ¶
- func Any[T any]() T
- func AnyBool() booldeprecated
- func AnyBoolSlice() []booldeprecated
- func AnyComplex128() complex128deprecated
- func AnyComplex128Slice() []complex128deprecated
- func AnyComplex64() complex64deprecated
- func AnyComplex64Slice() []complex64deprecated
- func AnyFloat32() float32deprecated
- func AnyFloat32Slice() []float32deprecated
- func AnyFloat64() float64deprecated
- func AnyFloat64Slice() []float64deprecated
- func AnyInt() intdeprecated
- func AnyInt16() int16deprecated
- func AnyInt16Slice() []int16deprecated
- func AnyInt32() int32deprecated
- func AnyInt32Slice() []int32deprecated
- func AnyInt64() int64deprecated
- func AnyInt64Slice() []int64deprecated
- func AnyInt8() int8deprecated
- func AnyInt8Slice() []int8deprecated
- func AnyIntSlice() []intdeprecated
- func AnyInterface() interface{}deprecated
- func AnyInterfaceSlice() []interface{}deprecated
- func AnyString() stringdeprecated
- func AnyStringSlice() []stringdeprecated
- func AnyUint() uintdeprecated
- func AnyUint16() uint16deprecated
- func AnyUint16Slice() []uint16deprecated
- func AnyUint32() uint32deprecated
- func AnyUint32Slice() []uint32deprecated
- func AnyUint64() uint64deprecated
- func AnyUint64Slice() []uint64deprecated
- func AnyUint8() uint8deprecated
- func AnyUint8Slice() []uint8deprecated
- func AnyUintSlice() []uintdeprecated
- func AnyUintptr() uintptrdeprecated
- func AnyUintptrSlice() []uintptrdeprecated
- func ArgThat[T any](matcher ArgumentMatcher) T
- func BoolSliceThat(matcher ArgumentMatcher) []booldeprecated
- func BoolThat(matcher ArgumentMatcher) booldeprecated
- func Complex128SliceThat(matcher ArgumentMatcher) []complex128deprecated
- func Complex128That(matcher ArgumentMatcher) complex128deprecated
- func Complex64SliceThat(matcher ArgumentMatcher) []complex64deprecated
- func Complex64That(matcher ArgumentMatcher) complex64deprecated
- func DumpInvocationsFor(mock Mock)
- func Eq[T any](value T) T
- func Float32SliceThat(matcher ArgumentMatcher) []float32deprecated
- func Float32That(matcher ArgumentMatcher) float32deprecated
- func Float64SliceThat(matcher ArgumentMatcher) []float64deprecated
- func Float64That(matcher ArgumentMatcher) float64deprecated
- func Int16SliceThat(matcher ArgumentMatcher) []int16deprecated
- func Int16That(matcher ArgumentMatcher) int16deprecated
- func Int32SliceThat(matcher ArgumentMatcher) []int32deprecated
- func Int32That(matcher ArgumentMatcher) int32deprecated
- func Int64SliceThat(matcher ArgumentMatcher) []int64deprecated
- func Int64That(matcher ArgumentMatcher) int64deprecated
- func Int8SliceThat(matcher ArgumentMatcher) []int8deprecated
- func Int8That(matcher ArgumentMatcher) int8deprecated
- func IntSliceThat(matcher ArgumentMatcher) []intdeprecated
- func IntThat(matcher ArgumentMatcher) intdeprecated
- func InterceptMockFailures(f func()) []string
- func InterfaceSliceThat(matcher ArgumentMatcher) []interface{}deprecated
- func InterfaceThat(matcher ArgumentMatcher) interface{}deprecated
- func NotEq[T any](value T) T
- func RegisterMatcher(matcher ArgumentMatcher)
- func RegisterMockFailHandler(handler FailHandler)
- func RegisterMockTestingT(t *testing.T)
- func SDumpInvocationsFor(mock Mock) string
- func StringSliceThat(matcher ArgumentMatcher) []stringdeprecated
- func StringThat(matcher ArgumentMatcher) stringdeprecated
- func Uint16SliceThat(matcher ArgumentMatcher) []uint16deprecated
- func Uint16That(matcher ArgumentMatcher) uint16deprecated
- func Uint32SliceThat(matcher ArgumentMatcher) []uint32deprecated
- func Uint32That(matcher ArgumentMatcher) uint32deprecated
- func Uint64SliceThat(matcher ArgumentMatcher) []uint64deprecated
- func Uint64That(matcher ArgumentMatcher) uint64deprecated
- func Uint8SliceThat(matcher ArgumentMatcher) []uint8deprecated
- func Uint8That(matcher ArgumentMatcher) uint8deprecated
- func UintSliceThat(matcher ArgumentMatcher) []uintdeprecated
- func UintThat(matcher ArgumentMatcher) uintdeprecated
- func UintptrSliceThat(matcher ArgumentMatcher) []uintptrdeprecated
- func UintptrThat(matcher ArgumentMatcher) uintptrdeprecated
- func When(invocation ...interface{}) *ongoingStubbing
- type AnyMatcher
- type ArgumentMatcher
- type AtLeastIntMatcher
- type AtMostIntMatcher
- type Counter
- type EqMatcher
- type FailHandler
- type GenericMock
- func (genericMock *GenericMock) GetInvocationParams(methodInvocations []MethodInvocation) [][]Param
- func (genericMock *GenericMock) Invoke(methodName string, params []Param, returnTypes []reflect.Type) ReturnValues
- func (genericMock *GenericMock) Verify(inOrderContext *InOrderContext, invocationCountMatcher InvocationCountMatcher, ...) []MethodInvocation
- type InOrderContext
- type InvocationCountMatcher
- type Matcher
- type Matchers
- type MethodInvocation
- type Mock
- type NotEqMatcher
- type Option
- type OptionFunc
- type Param
- type ReturnValue
- type ReturnValues
- type Stubbing
- type Stubbings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyBoolSlice
deprecated
func AnyBoolSlice() []bool
Deprecated: Use Any[T any]() instead.
func AnyComplex128
deprecated
func AnyComplex128() complex128
Deprecated: Use Any[T any]() instead.
func AnyComplex128Slice
deprecated
func AnyComplex128Slice() []complex128
Deprecated: Use Any[T any]() instead.
func AnyComplex64
deprecated
func AnyComplex64() complex64
Deprecated: Use Any[T any]() instead.
func AnyComplex64Slice
deprecated
func AnyComplex64Slice() []complex64
Deprecated: Use Any[T any]() instead.
func AnyFloat32
deprecated
func AnyFloat32() float32
Deprecated: Use Any[T any]() instead.
func AnyFloat32Slice
deprecated
func AnyFloat32Slice() []float32
Deprecated: Use Any[T any]() instead.
func AnyFloat64
deprecated
func AnyFloat64() float64
Deprecated: Use Any[T any]() instead.
func AnyFloat64Slice
deprecated
func AnyFloat64Slice() []float64
Deprecated: Use Any[T any]() instead.
func AnyInt16Slice
deprecated
func AnyInt16Slice() []int16
Deprecated: Use Any[T any]() instead.
func AnyInt32Slice
deprecated
func AnyInt32Slice() []int32
Deprecated: Use Any[T any]() instead.
func AnyInt64Slice
deprecated
func AnyInt64Slice() []int64
Deprecated: Use Any[T any]() instead.
func AnyInt8Slice
deprecated
func AnyInt8Slice() []int8
Deprecated: Use Any[T any]() instead.
func AnyIntSlice
deprecated
func AnyIntSlice() []int
Deprecated: Use Any[T any]() instead.
func AnyInterface
deprecated
func AnyInterface() interface{}
Deprecated: Use Any[T any]() instead.
func AnyInterfaceSlice
deprecated
func AnyInterfaceSlice() []interface{}
Deprecated: Use Any[T any]() instead.
func AnyStringSlice
deprecated
func AnyStringSlice() []string
Deprecated: Use Any[T any]() instead.
func AnyUint16Slice
deprecated
func AnyUint16Slice() []uint16
Deprecated: Use Any[T any]() instead.
func AnyUint32Slice
deprecated
func AnyUint32Slice() []uint32
Deprecated: Use Any[T any]() instead.
func AnyUint64Slice
deprecated
func AnyUint64Slice() []uint64
Deprecated: Use Any[T any]() instead.
func AnyUint8Slice
deprecated
func AnyUint8Slice() []uint8
Deprecated: Use Any[T any]() instead.
func AnyUintSlice
deprecated
func AnyUintSlice() []uint
Deprecated: Use Any[T any]() instead.
func AnyUintptr
deprecated
func AnyUintptr() uintptr
Deprecated: Use Any[T any]() instead.
func AnyUintptrSlice
deprecated
func AnyUintptrSlice() []uintptr
Deprecated: Use Any[T any]() instead.
func ArgThat ¶
func ArgThat[T any](matcher ArgumentMatcher) T
func BoolSliceThat
deprecated
func BoolSliceThat(matcher ArgumentMatcher) []bool
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func BoolThat
deprecated
func BoolThat(matcher ArgumentMatcher) bool
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Complex128SliceThat
deprecated
func Complex128SliceThat(matcher ArgumentMatcher) []complex128
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Complex128That
deprecated
func Complex128That(matcher ArgumentMatcher) complex128
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Complex64SliceThat
deprecated
func Complex64SliceThat(matcher ArgumentMatcher) []complex64
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Complex64That
deprecated
func Complex64That(matcher ArgumentMatcher) complex64
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func DumpInvocationsFor ¶
func DumpInvocationsFor(mock Mock)
func Float32SliceThat
deprecated
func Float32SliceThat(matcher ArgumentMatcher) []float32
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Float32That
deprecated
func Float32That(matcher ArgumentMatcher) float32
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Float64SliceThat
deprecated
func Float64SliceThat(matcher ArgumentMatcher) []float64
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Float64That
deprecated
func Float64That(matcher ArgumentMatcher) float64
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Int16SliceThat
deprecated
func Int16SliceThat(matcher ArgumentMatcher) []int16
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Int16That
deprecated
func Int16That(matcher ArgumentMatcher) int16
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Int32SliceThat
deprecated
func Int32SliceThat(matcher ArgumentMatcher) []int32
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Int32That
deprecated
func Int32That(matcher ArgumentMatcher) int32
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Int64SliceThat
deprecated
func Int64SliceThat(matcher ArgumentMatcher) []int64
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Int64That
deprecated
func Int64That(matcher ArgumentMatcher) int64
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Int8SliceThat
deprecated
func Int8SliceThat(matcher ArgumentMatcher) []int8
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Int8That
deprecated
func Int8That(matcher ArgumentMatcher) int8
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func IntSliceThat
deprecated
func IntSliceThat(matcher ArgumentMatcher) []int
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func IntThat
deprecated
func IntThat(matcher ArgumentMatcher) int
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func InterceptMockFailures ¶
func InterceptMockFailures(f func()) []string
InterceptMockFailures runs a given callback and returns an array of failure messages generated by any Pegomock verifications within the callback.
This is accomplished by temporarily replacing the *global* fail handler with a fail handler that simply annotates failures. The original fail handler is reset when InterceptMockFailures returns.
func InterfaceSliceThat
deprecated
func InterfaceSliceThat(matcher ArgumentMatcher) []interface{}
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func InterfaceThat
deprecated
func InterfaceThat(matcher ArgumentMatcher) interface{}
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func RegisterMatcher ¶
func RegisterMatcher(matcher ArgumentMatcher)
func RegisterMockFailHandler ¶
func RegisterMockFailHandler(handler FailHandler)
func RegisterMockTestingT ¶
func SDumpInvocationsFor ¶
func StringSliceThat
deprecated
func StringSliceThat(matcher ArgumentMatcher) []string
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func StringThat
deprecated
func StringThat(matcher ArgumentMatcher) string
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Uint16SliceThat
deprecated
func Uint16SliceThat(matcher ArgumentMatcher) []uint16
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Uint16That
deprecated
func Uint16That(matcher ArgumentMatcher) uint16
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Uint32SliceThat
deprecated
func Uint32SliceThat(matcher ArgumentMatcher) []uint32
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Uint32That
deprecated
func Uint32That(matcher ArgumentMatcher) uint32
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Uint64SliceThat
deprecated
func Uint64SliceThat(matcher ArgumentMatcher) []uint64
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Uint64That
deprecated
func Uint64That(matcher ArgumentMatcher) uint64
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Uint8SliceThat
deprecated
func Uint8SliceThat(matcher ArgumentMatcher) []uint8
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func Uint8That
deprecated
func Uint8That(matcher ArgumentMatcher) uint8
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func UintSliceThat
deprecated
func UintSliceThat(matcher ArgumentMatcher) []uint
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func UintThat
deprecated
func UintThat(matcher ArgumentMatcher) uint
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func UintptrSliceThat
deprecated
func UintptrSliceThat(matcher ArgumentMatcher) []uintptr
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
func UintptrThat
deprecated
func UintptrThat(matcher ArgumentMatcher) uintptr
Deprecated: Use ArgThat[T any](matcher ArgumentMatcher) instead.
Types ¶
type AnyMatcher ¶
func NewAnyMatcher ¶
func NewAnyMatcher(typ reflect.Type) *AnyMatcher
func (*AnyMatcher) FailureMessage ¶
func (matcher *AnyMatcher) FailureMessage() string
func (*AnyMatcher) Matches ¶
func (matcher *AnyMatcher) Matches(param Param) bool
func (*AnyMatcher) String ¶
func (matcher *AnyMatcher) String() string
type ArgumentMatcher ¶
ArgumentMatcher can be used to match arguments.
type AtLeastIntMatcher ¶
type AtLeastIntMatcher struct { Value int // contains filtered or unexported fields }
func AtLeast ¶
func AtLeast(numDesiredInvocations int) *AtLeastIntMatcher
func (*AtLeastIntMatcher) FailureMessage ¶
func (matcher *AtLeastIntMatcher) FailureMessage() string
func (*AtLeastIntMatcher) Matches ¶
func (matcher *AtLeastIntMatcher) Matches(param Param) bool
func (*AtLeastIntMatcher) String ¶
func (matcher *AtLeastIntMatcher) String() string
type AtMostIntMatcher ¶
type AtMostIntMatcher struct { Value int // contains filtered or unexported fields }
func AtMost ¶
func AtMost(numDesiredInvocations int) *AtMostIntMatcher
func (*AtMostIntMatcher) FailureMessage ¶
func (matcher *AtMostIntMatcher) FailureMessage() string
func (*AtMostIntMatcher) Matches ¶
func (matcher *AtMostIntMatcher) Matches(param Param) bool
func (*AtMostIntMatcher) String ¶
func (matcher *AtMostIntMatcher) String() string
type EqMatcher ¶
func (*EqMatcher) FailureMessage ¶
type FailHandler ¶
var GlobalFailHandler FailHandler
func BuildTestingTFailHandler ¶
func BuildTestingTFailHandler(t testingT) FailHandler
type GenericMock ¶
func GetGenericMockFrom ¶
func GetGenericMockFrom(mock Mock) *GenericMock
func (*GenericMock) GetInvocationParams ¶
func (genericMock *GenericMock) GetInvocationParams(methodInvocations []MethodInvocation) [][]Param
TODO this doesn't need to be a method, can be a free function
func (*GenericMock) Invoke ¶
func (genericMock *GenericMock) Invoke(methodName string, params []Param, returnTypes []reflect.Type) ReturnValues
func (*GenericMock) Verify ¶
func (genericMock *GenericMock) Verify( inOrderContext *InOrderContext, invocationCountMatcher InvocationCountMatcher, methodName string, params []Param, options ...interface{}, ) []MethodInvocation
type InOrderContext ¶
type InOrderContext struct {
// contains filtered or unexported fields
}
type InvocationCountMatcher ¶
InvocationCountMatcher can be used to match invocation counts. It is guaranteed that FailureMessage will always be called after Matches so an implementation can save state.
type Matcher ¶
Matcher can be used to match arguments as well as invocation counts. Note that support for overlapping embedded interfaces was added in Go 1.14, which is why ArgumentMatcher and InvocationCountMatcher are not embedded here.
type Matchers ¶
type Matchers []ArgumentMatcher
type MethodInvocation ¶
type MethodInvocation struct {
// contains filtered or unexported fields
}
type Mock ¶
type Mock interface { SetFailHandler(FailHandler) FailHandler() FailHandler }
type NotEqMatcher ¶
type NotEqMatcher struct {
Value Param
}
func (*NotEqMatcher) FailureMessage ¶
func (matcher *NotEqMatcher) FailureMessage() string
func (*NotEqMatcher) Matches ¶
func (matcher *NotEqMatcher) Matches(param Param) bool
func (*NotEqMatcher) String ¶
func (matcher *NotEqMatcher) String() string
type Option ¶
type Option interface{ Apply(Mock) }
func WithFailHandler ¶
func WithFailHandler(fail FailHandler) Option
type OptionFunc ¶
type OptionFunc func(mock Mock)
func (OptionFunc) Apply ¶
func (f OptionFunc) Apply(mock Mock)
type ReturnValue ¶
type ReturnValue interface{}
type ReturnValues ¶
type ReturnValues []ReturnValue
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
Package mockgen generates mock implementations of Go interfaces.
|
Package mockgen generates mock implementations of Go interfaces. |
Package model contains the data model necessary for generating mock implementations.
|
Package model contains the data model necessary for generating mock implementations. |
modelgen
|
|