pegomock: github.com/petergtz/pegomock Index | Files | Directories

package pegomock

import "github.com/petergtz/pegomock"

Index

Package Files

dsl.go invocation_count_matchers.go matcher.go matcher_factories.go testing_t_support.go types.go

func AnyBool Uses

func AnyBool() bool

func AnyBoolSlice Uses

func AnyBoolSlice() []bool

func AnyComplex128 Uses

func AnyComplex128() complex128

func AnyComplex128Slice Uses

func AnyComplex128Slice() []complex128

func AnyComplex64 Uses

func AnyComplex64() complex64

func AnyComplex64Slice Uses

func AnyComplex64Slice() []complex64

func AnyFloat32 Uses

func AnyFloat32() float32

func AnyFloat32Slice Uses

func AnyFloat32Slice() []float32

func AnyFloat64 Uses

func AnyFloat64() float64

func AnyFloat64Slice Uses

func AnyFloat64Slice() []float64

func AnyInt Uses

func AnyInt() int

func AnyInt16 Uses

func AnyInt16() int16

func AnyInt16Slice Uses

func AnyInt16Slice() []int16

func AnyInt32 Uses

func AnyInt32() int32

func AnyInt32Slice Uses

func AnyInt32Slice() []int32

func AnyInt64 Uses

func AnyInt64() int64

func AnyInt64Slice Uses

func AnyInt64Slice() []int64

func AnyInt8 Uses

func AnyInt8() int8

func AnyInt8Slice Uses

func AnyInt8Slice() []int8

func AnyIntSlice Uses

func AnyIntSlice() []int

func AnyInterface Uses

func AnyInterface() interface{}

func AnyInterfaceSlice Uses

func AnyInterfaceSlice() []interface{}

func AnyString Uses

func AnyString() string

func AnyStringSlice Uses

func AnyStringSlice() []string

func AnyUint Uses

func AnyUint() uint

func AnyUint16 Uses

func AnyUint16() uint16

func AnyUint16Slice Uses

func AnyUint16Slice() []uint16

func AnyUint32 Uses

func AnyUint32() uint32

func AnyUint32Slice Uses

func AnyUint32Slice() []uint32

func AnyUint64 Uses

func AnyUint64() uint64

func AnyUint64Slice Uses

func AnyUint64Slice() []uint64

func AnyUint8 Uses

func AnyUint8() uint8

func AnyUint8Slice Uses

func AnyUint8Slice() []uint8

func AnyUintSlice Uses

func AnyUintSlice() []uint

func AnyUintptr Uses

func AnyUintptr() uintptr

func AnyUintptrSlice Uses

func AnyUintptrSlice() []uintptr

func BoolSliceThat Uses

func BoolSliceThat(matcher ArgumentMatcher) []bool

func BoolThat Uses

func BoolThat(matcher ArgumentMatcher) bool

func Complex128SliceThat Uses

func Complex128SliceThat(matcher ArgumentMatcher) []complex128

func Complex128That Uses

func Complex128That(matcher ArgumentMatcher) complex128

func Complex64SliceThat Uses

func Complex64SliceThat(matcher ArgumentMatcher) []complex64

func Complex64That Uses

func Complex64That(matcher ArgumentMatcher) complex64

func DumpInvocationsFor Uses

func DumpInvocationsFor(mock Mock)

func EqBool Uses

func EqBool(value bool) bool

func EqBoolSlice Uses

func EqBoolSlice(value []bool) []bool

func EqComplex128 Uses

func EqComplex128(value complex128) complex128

func EqComplex128Slice Uses

func EqComplex128Slice(value []complex128) []complex128

func EqComplex64 Uses

func EqComplex64(value complex64) complex64

func EqComplex64Slice Uses

func EqComplex64Slice(value []complex64) []complex64

func EqFloat32 Uses

func EqFloat32(value float32) float32

func EqFloat32Slice Uses

func EqFloat32Slice(value []float32) []float32

func EqFloat64 Uses

func EqFloat64(value float64) float64

func EqFloat64Slice Uses

func EqFloat64Slice(value []float64) []float64

func EqInt Uses

func EqInt(value int) int

func EqInt16 Uses

func EqInt16(value int16) int16

func EqInt16Slice Uses

func EqInt16Slice(value []int16) []int16

func EqInt32 Uses

func EqInt32(value int32) int32

func EqInt32Slice Uses

func EqInt32Slice(value []int32) []int32

func EqInt64 Uses

func EqInt64(value int64) int64

func EqInt64Slice Uses

func EqInt64Slice(value []int64) []int64

func EqInt8 Uses

func EqInt8(value int8) int8

func EqInt8Slice Uses

func EqInt8Slice(value []int8) []int8

func EqIntSlice Uses

func EqIntSlice(value []int) []int

func EqInterface Uses

func EqInterface(value interface{}) interface{}

func EqInterfaceSlice Uses

func EqInterfaceSlice(value []interface{}) []interface{}

func EqString Uses

func EqString(value string) string

func EqStringSlice Uses

func EqStringSlice(value []string) []string

func EqUint Uses

func EqUint(value uint) uint

func EqUint16 Uses

func EqUint16(value uint16) uint16

func EqUint16Slice Uses

func EqUint16Slice(value []uint16) []uint16

func EqUint32 Uses

func EqUint32(value uint32) uint32

func EqUint32Slice Uses

func EqUint32Slice(value []uint32) []uint32

func EqUint64 Uses

func EqUint64(value uint64) uint64

func EqUint64Slice Uses

func EqUint64Slice(value []uint64) []uint64

func EqUint8 Uses

func EqUint8(value uint8) uint8

func EqUint8Slice Uses

func EqUint8Slice(value []uint8) []uint8

func EqUintSlice Uses

func EqUintSlice(value []uint) []uint

func EqUintptr Uses

func EqUintptr(value uintptr) uintptr

func EqUintptrSlice Uses

func EqUintptrSlice(value []uintptr) []uintptr

func Float32SliceThat Uses

func Float32SliceThat(matcher ArgumentMatcher) []float32

func Float32That Uses

func Float32That(matcher ArgumentMatcher) float32

func Float64SliceThat Uses

func Float64SliceThat(matcher ArgumentMatcher) []float64

func Float64That Uses

func Float64That(matcher ArgumentMatcher) float64

func Int16SliceThat Uses

func Int16SliceThat(matcher ArgumentMatcher) []int16

func Int16That Uses

func Int16That(matcher ArgumentMatcher) int16

func Int32SliceThat Uses

func Int32SliceThat(matcher ArgumentMatcher) []int32

func Int32That Uses

func Int32That(matcher ArgumentMatcher) int32

func Int64SliceThat Uses

func Int64SliceThat(matcher ArgumentMatcher) []int64

func Int64That Uses

func Int64That(matcher ArgumentMatcher) int64

func Int8SliceThat Uses

func Int8SliceThat(matcher ArgumentMatcher) []int8

func Int8That Uses

func Int8That(matcher ArgumentMatcher) int8

func IntSliceThat Uses

func IntSliceThat(matcher ArgumentMatcher) []int

func IntThat Uses

func IntThat(matcher ArgumentMatcher) int

func InterceptMockFailures Uses

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 Uses

func InterfaceSliceThat(matcher ArgumentMatcher) []interface{}

func InterfaceThat Uses

func InterfaceThat(matcher ArgumentMatcher) interface{}

func NotEqBool Uses

func NotEqBool(value bool) bool

func NotEqBoolSlice Uses

func NotEqBoolSlice(value []bool) []bool

func NotEqComplex128 Uses

func NotEqComplex128(value complex128) complex128

func NotEqComplex128Slice Uses

func NotEqComplex128Slice(value []complex128) []complex128

func NotEqComplex64 Uses

func NotEqComplex64(value complex64) complex64

func NotEqComplex64Slice Uses

func NotEqComplex64Slice(value []complex64) []complex64

func NotEqFloat32 Uses

func NotEqFloat32(value float32) float32

func NotEqFloat32Slice Uses

func NotEqFloat32Slice(value []float32) []float32

func NotEqFloat64 Uses

func NotEqFloat64(value float64) float64

func NotEqFloat64Slice Uses

func NotEqFloat64Slice(value []float64) []float64

func NotEqInt Uses

func NotEqInt(value int) int

func NotEqInt16 Uses

func NotEqInt16(value int16) int16

func NotEqInt16Slice Uses

func NotEqInt16Slice(value []int16) []int16

func NotEqInt32 Uses

func NotEqInt32(value int32) int32

func NotEqInt32Slice Uses

func NotEqInt32Slice(value []int32) []int32

func NotEqInt64 Uses

func NotEqInt64(value int64) int64

func NotEqInt64Slice Uses

func NotEqInt64Slice(value []int64) []int64

func NotEqInt8 Uses

func NotEqInt8(value int8) int8

func NotEqInt8Slice Uses

func NotEqInt8Slice(value []int8) []int8

func NotEqIntSlice Uses

func NotEqIntSlice(value []int) []int

func NotEqInterface Uses

func NotEqInterface(value interface{}) interface{}

func NotEqInterfaceSlice Uses

func NotEqInterfaceSlice(value []interface{}) []interface{}

func NotEqString Uses

func NotEqString(value string) string

func NotEqStringSlice Uses

func NotEqStringSlice(value []string) []string

func NotEqUint Uses

func NotEqUint(value uint) uint

func NotEqUint16 Uses

func NotEqUint16(value uint16) uint16

func NotEqUint16Slice Uses

func NotEqUint16Slice(value []uint16) []uint16

func NotEqUint32 Uses

func NotEqUint32(value uint32) uint32

func NotEqUint32Slice Uses

func NotEqUint32Slice(value []uint32) []uint32

func NotEqUint64 Uses

func NotEqUint64(value uint64) uint64

func NotEqUint64Slice Uses

func NotEqUint64Slice(value []uint64) []uint64

func NotEqUint8 Uses

func NotEqUint8(value uint8) uint8

func NotEqUint8Slice Uses

func NotEqUint8Slice(value []uint8) []uint8

func NotEqUintSlice Uses

func NotEqUintSlice(value []uint) []uint

func NotEqUintptr Uses

func NotEqUintptr(value uintptr) uintptr

func NotEqUintptrSlice Uses

func NotEqUintptrSlice(value []uintptr) []uintptr

func RegisterMatcher Uses

func RegisterMatcher(matcher ArgumentMatcher)

func RegisterMockFailHandler Uses

func RegisterMockFailHandler(handler FailHandler)

func RegisterMockTestingT Uses

func RegisterMockTestingT(t *testing.T)

func SDumpInvocationsFor Uses

func SDumpInvocationsFor(mock Mock) string

func StringSliceThat Uses

func StringSliceThat(matcher ArgumentMatcher) []string

func StringThat Uses

func StringThat(matcher ArgumentMatcher) string

func Uint16SliceThat Uses

func Uint16SliceThat(matcher ArgumentMatcher) []uint16

func Uint16That Uses

func Uint16That(matcher ArgumentMatcher) uint16

func Uint32SliceThat Uses

func Uint32SliceThat(matcher ArgumentMatcher) []uint32

func Uint32That Uses

func Uint32That(matcher ArgumentMatcher) uint32

func Uint64SliceThat Uses

func Uint64SliceThat(matcher ArgumentMatcher) []uint64

func Uint64That Uses

func Uint64That(matcher ArgumentMatcher) uint64

func Uint8SliceThat Uses

func Uint8SliceThat(matcher ArgumentMatcher) []uint8

func Uint8That Uses

func Uint8That(matcher ArgumentMatcher) uint8

func UintSliceThat Uses

func UintSliceThat(matcher ArgumentMatcher) []uint

func UintThat Uses

func UintThat(matcher ArgumentMatcher) uint

func UintptrSliceThat Uses

func UintptrSliceThat(matcher ArgumentMatcher) []uintptr

func UintptrThat Uses

func UintptrThat(matcher ArgumentMatcher) uintptr

func When Uses

func When(invocation ...interface{}) *ongoingStubbing

type AnyMatcher Uses

type AnyMatcher struct {
    Type reflect.Type

    sync.Mutex
    // contains filtered or unexported fields
}

func NewAnyMatcher Uses

func NewAnyMatcher(typ reflect.Type) *AnyMatcher

func (*AnyMatcher) FailureMessage Uses

func (matcher *AnyMatcher) FailureMessage() string

func (*AnyMatcher) Matches Uses

func (matcher *AnyMatcher) Matches(param Param) bool

func (*AnyMatcher) String Uses

func (matcher *AnyMatcher) String() string

type ArgumentMatcher Uses

type ArgumentMatcher interface {
    Matches(param Param) bool
    fmt.Stringer
}

ArgumentMatcher can be used to match arguments.

type AtLeastIntMatcher Uses

type AtLeastIntMatcher struct {
    Value int
    // contains filtered or unexported fields
}

func AtLeast Uses

func AtLeast(numDesiredInvocations int) *AtLeastIntMatcher

func (*AtLeastIntMatcher) FailureMessage Uses

func (matcher *AtLeastIntMatcher) FailureMessage() string

func (*AtLeastIntMatcher) Matches Uses

func (matcher *AtLeastIntMatcher) Matches(param Param) bool

func (*AtLeastIntMatcher) String Uses

func (matcher *AtLeastIntMatcher) String() string

type AtMostIntMatcher Uses

type AtMostIntMatcher struct {
    Value int
    // contains filtered or unexported fields
}

func AtMost Uses

func AtMost(numDesiredInvocations int) *AtMostIntMatcher

func (*AtMostIntMatcher) FailureMessage Uses

func (matcher *AtMostIntMatcher) FailureMessage() string

func (*AtMostIntMatcher) Matches Uses

func (matcher *AtMostIntMatcher) Matches(param Param) bool

func (*AtMostIntMatcher) String Uses

func (matcher *AtMostIntMatcher) String() string

type Counter Uses

type Counter struct {
    sync.Mutex
    // contains filtered or unexported fields
}

type EqMatcher Uses

type EqMatcher struct {
    Value Param

    sync.Mutex
    // contains filtered or unexported fields
}

func Never Uses

func Never() *EqMatcher

func Once Uses

func Once() *EqMatcher

func Times Uses

func Times(numDesiredInvocations int) *EqMatcher

func Twice Uses

func Twice() *EqMatcher

func (*EqMatcher) FailureMessage Uses

func (matcher *EqMatcher) FailureMessage() string

func (*EqMatcher) Matches Uses

func (matcher *EqMatcher) Matches(param Param) bool

func (*EqMatcher) String Uses

func (matcher *EqMatcher) String() string

type FailHandler Uses

type FailHandler func(message string, callerSkip ...int)
var GlobalFailHandler FailHandler

func BuildTestingTFailHandler Uses

func BuildTestingTFailHandler(t testingT) FailHandler

type GenericMock Uses

type GenericMock struct {
    sync.Mutex
    // contains filtered or unexported fields
}

func GetGenericMockFrom Uses

func GetGenericMockFrom(mock Mock) *GenericMock

func (*GenericMock) GetInvocationParams Uses

func (genericMock *GenericMock) GetInvocationParams(methodInvocations []MethodInvocation) [][]Param

TODO this doesn't need to be a method, can be a free function

func (*GenericMock) Invoke Uses

func (genericMock *GenericMock) Invoke(methodName string, params []Param, returnTypes []reflect.Type) ReturnValues

func (*GenericMock) Verify Uses

func (genericMock *GenericMock) Verify(
    inOrderContext *InOrderContext,
    invocationCountMatcher InvocationCountMatcher,
    methodName string,
    params []Param,
    options ...interface{},
) []MethodInvocation

type InOrderContext Uses

type InOrderContext struct {
    // contains filtered or unexported fields
}

type InvocationCountMatcher Uses

type InvocationCountMatcher interface {
    Matches(param Param) bool
    FailureMessage() string
}

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 Uses

type Matcher interface {
    Matches(param Param) bool
    FailureMessage() string
    fmt.Stringer
}

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 Uses

type Matchers []ArgumentMatcher

func (Matchers) Matches Uses

func (matchers Matchers) Matches(params []Param) bool

type MethodInvocation Uses

type MethodInvocation struct {
    // contains filtered or unexported fields
}

type Mock Uses

type Mock interface {
    SetFailHandler(FailHandler)
    FailHandler() FailHandler
}

type NotEqMatcher Uses

type NotEqMatcher struct {
    Value Param
}

func (*NotEqMatcher) FailureMessage Uses

func (matcher *NotEqMatcher) FailureMessage() string

func (*NotEqMatcher) Matches Uses

func (matcher *NotEqMatcher) Matches(param Param) bool

func (*NotEqMatcher) String Uses

func (matcher *NotEqMatcher) String() string

type Option Uses

type Option interface{ Apply(Mock) }

func WithFailHandler Uses

func WithFailHandler(fail FailHandler) Option

func WithT Uses

func WithT(t testingT) Option

type OptionFunc Uses

type OptionFunc func(mock Mock)

func (OptionFunc) Apply Uses

func (f OptionFunc) Apply(mock Mock)

type Param Uses

type Param interface{}

type ReturnValue Uses

type ReturnValue interface{}

type ReturnValues Uses

type ReturnValues []ReturnValue

type Stubbing Uses

type Stubbing struct {
    // contains filtered or unexported fields
}

func (*Stubbing) Invoke Uses

func (stubbing *Stubbing) Invoke(params []Param) ReturnValues

type Stubbings Uses

type Stubbings []*Stubbing

Directories

PathSynopsis
ginkgo_compatible
internal/generate_matchers
internal/verify
matchersCode generated by pegomock.
mockgenMockGen generates mock implementations of Go interfaces.
mockgen/util
modelPackage model contains the data model necessary for generating mock implementations.
modelgen/gomock
modelgen/loader
modelgen/test_data/default_test_interface
pegomock
pegomock/filehandling
pegomock/remove
pegomock/testutil
pegomock/util
pegomock/watch
test_interface

Package pegomock imports 12 packages (graph) and is imported by 153 packages. Updated 2020-12-15. Refresh now. Tools for package owners.