Documentation
¶
Overview ¶
Package moq is used by test code to interact with Moqueries mocks
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Expectation ExpectationMode Sequence SequenceMode }
Config is passed to a moq to provide configuration for the moq
type ExpectationMode ¶
type ExpectationMode int
ExpectationMode determines the behavior of a moq when a method is invoked with no matching expectations
const ( // Strict mode causes a moq to validate each method invocation Strict ExpectationMode = iota // Nice mode will return zero values for any unexpected invocation Nice )
type Moq ¶
type Moq interface { Reset() AssertExpectationsMet() }
Moq is implemented by all moqs so that they can integrate with a scene
type OptionalTimer ¶
type OptionalTimer struct{}
OptionalTimer holds an optional value
func Optional ¶
func Optional() OptionalTimer
Optional is similar to calling MinTimes(0) but doesn't change the max
type ParamIndexing ¶
type ParamIndexing int
ParamIndexing values determine how parameters are indexed in a moq
const ( // ParamIndexByValue indicates that a specific parameter of a specific // function will be indexed by it value alone. The parameter value will be // copied into a parameter key so simple equality will determine if an // expectation matches an actual call. The exact same instance must be // supplied to both the expectation call and the actual call. ParamIndexByValue ParamIndexing = iota // ParamIndexByHash indicates that a specific parameter of a specific // function will be indexed by a deep hash value. A deep hash library is // used to uniquely identify the parameter's value which includes the // values of any parameter subtypes. The exact same instance will only // match an expectation to an actual call if the internal state of the // instance hasn't changed. ParamIndexByHash )
type RepeatVal ¶
type RepeatVal struct {
// MinTimes and MaxTimes record the minimum and maximum number of times a
// call must be made for a test to pass
MinTimes, MaxTimes int
// AnyTimes indicates that a call can be made any number of times
AnyTimes bool
// ResultCount is used by a moq to size the results slice large enough to
// hold all the expected results
ResultCount int
// ExplicitAny indicates that AnyTimes is true from an explicit use of
// moq.AnyTimes
ExplicitAny bool
// Incremented indicates that Increment has been called as required before
// calling Repeat
Incremented bool
}
RepeatVal is a compilation of multiple repeaters for use in a moq
type Repeater ¶
type Repeater interface {
// contains filtered or unexported methods
}
Repeater is implemented by all repeaters
type Scene ¶
type Scene struct { T T // contains filtered or unexported fields }
Scene stores a collection of moqs so that they can work together
func (*Scene) AssertExpectationsMet ¶
func (s *Scene) AssertExpectationsMet()
AssertExpectationsMet asserts that all expectations for all moqs in the scene are met
func (*Scene) NextMockSequence ¶
NextMockSequence returns the next sequence value when a call is being made to a mock
func (*Scene) NextRecorderSequence ¶
NextRecorderSequence returns the next sequence value for a recorder when recording expectations
type SequenceMode ¶
type SequenceMode int
SequenceMode is used in conjunction with the generated seq and noSeq methods when checking call sequences
const ( // SeqDefaultOff indicates that call sequences will not be reserved for any // calls but individual calls can turn on sequences SeqDefaultOff SequenceMode = iota // SeqDefaultOn indicates that call sequences will be reserved for all // calls but individual calls can turn off sequences SeqDefaultOn )