Documentation
¶
Index ¶
- Variables
- func Called(t assert.TestingT, mockFn interface{}, msgAndArgs ...interface{}) bool
- func CalledAtNWith(t assert.TestingT, mockFn interface{}, n int, asserter CallInstanceAsserter, ...) bool
- func CalledN(t assert.TestingT, mockFn interface{}, n int, msgAndArgs ...interface{}) bool
- func CalledNWith(t assert.TestingT, mockFn interface{}, n int, asserter CallInstanceAsserter, ...) bool
- func CalledOnce(t assert.TestingT, mockFn interface{}, msgAndArgs ...interface{}) bool
- func CalledOnceWith(t assert.TestingT, mockFn interface{}, asserter CallInstanceAsserter, ...) bool
- func CalledWith(t assert.TestingT, mockFn interface{}, asserter CallInstanceAsserter, ...) bool
- func NotCalled(t assert.TestingT, mockFn interface{}, msgAndArgs ...interface{}) bool
- func NotCalledWith(t assert.TestingT, mockFn interface{}, asserter CallInstanceAsserter, ...) bool
- type CallInstanceAsserter
- type CallInstanceAsserterFunc
Constants ¶
This section is empty.
Variables ¶
var Skip = &skip{}
Skip is a sentinel value which is skipped in a call instance asserter. This is useful when used to skip the leading "don't care" values such as leading context parameters.
Functions ¶
func CalledAtNWith ¶
func CalledAtNWith(t assert.TestingT, mockFn interface{}, n int, asserter CallInstanceAsserter, msgAndArgs ...interface{}) bool
CalledAtNWith asserts that the mock function objects nth call was with a set of arguments matching the given call instance asserter.
func CalledNWith ¶
func CalledNWith(t assert.TestingT, mockFn interface{}, n int, asserter CallInstanceAsserter, msgAndArgs ...interface{}) bool
CalledNWith asserts that the mock function object was called exactly n times with a set of arguments matching the given call instance asserter.
func CalledOnce ¶
CalledOnce asserts that the mock function object was called exactly once.
func CalledOnceWith ¶
func CalledOnceWith(t assert.TestingT, mockFn interface{}, asserter CallInstanceAsserter, msgAndArgs ...interface{}) bool
CalledOnceWith asserts that the mock function object was called exactly once with a set of arguments matching the given call instance asserter.
func CalledWith ¶
func CalledWith(t assert.TestingT, mockFn interface{}, asserter CallInstanceAsserter, msgAndArgs ...interface{}) bool
CalledWith asserts that the mock function object was called at least once with a set of arguments matching the given call instance asserter.
func NotCalledWith ¶
func NotCalledWith(t assert.TestingT, mockFn interface{}, asserter CallInstanceAsserter, msgAndArgs ...interface{}) bool
NotCalledWith asserts that the mock function object was not called with a set of arguments matching the given call instance asserter.
Types ¶
type CallInstanceAsserter ¶
type CallInstanceAsserter interface { // Assert determines if the given argument values matches the expected // function call. Assert(interface{}) bool }
CallInstanceAsserter determines whether or not a set of argument values from a call of a mock function match the test constraints of a particular function call. See the assertions `CalledWith`, `NotCalledWith`, `CalledOnceWith`, `CalledNWith`, and `CalledAtNWith` for further usage.
func Values ¶
func Values(expectedValues ...interface{}) CallInstanceAsserter
Values returns a new call instance asserter that will match the arguments of each function call positionally with each of the expected values. The assertion behavior in each position can be tuned:
Use the value `mockassert.Skip` to skip validation for values in that parameter position.
Use a function with the type `func(v T) bool` (for any `T`) to override validation for values in that parameter position.
type CallInstanceAsserterFunc ¶
type CallInstanceAsserterFunc func(v interface{}) bool
func (CallInstanceAsserterFunc) Assert ¶
func (f CallInstanceAsserterFunc) Assert(v interface{}) bool