mirror of
https://github.com/stretchr/testify.git
synced 2025-04-29 07:14:39 +00:00
Merge pull request #1636 from rainhq/jayd3e.fix_return_arguments
Record Return Arguments of a Call
This commit is contained in:
commit
a012e45d18
@ -80,12 +80,12 @@ type Call struct {
|
|||||||
requires []*Call
|
requires []*Call
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments ...interface{}) *Call {
|
func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments Arguments, returnArguments Arguments) *Call {
|
||||||
return &Call{
|
return &Call{
|
||||||
Parent: parent,
|
Parent: parent,
|
||||||
Method: methodName,
|
Method: methodName,
|
||||||
Arguments: methodArguments,
|
Arguments: methodArguments,
|
||||||
ReturnArguments: make([]interface{}, 0),
|
ReturnArguments: returnArguments,
|
||||||
callerInfo: callerInfo,
|
callerInfo: callerInfo,
|
||||||
Repeatability: 0,
|
Repeatability: 0,
|
||||||
WaitFor: nil,
|
WaitFor: nil,
|
||||||
@ -365,7 +365,8 @@ func (m *Mock) On(methodName string, arguments ...interface{}) *Call {
|
|||||||
|
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
defer m.mutex.Unlock()
|
defer m.mutex.Unlock()
|
||||||
c := newCall(m, methodName, assert.CallerInfo(), arguments...)
|
|
||||||
|
c := newCall(m, methodName, assert.CallerInfo(), arguments, make([]interface{}, 0))
|
||||||
m.ExpectedCalls = append(m.ExpectedCalls, c)
|
m.ExpectedCalls = append(m.ExpectedCalls, c)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
@ -544,7 +545,7 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen
|
|||||||
call.totalCalls++
|
call.totalCalls++
|
||||||
|
|
||||||
// add the call
|
// add the call
|
||||||
m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments...))
|
m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments, call.ReturnArguments))
|
||||||
m.mutex.Unlock()
|
m.mutex.Unlock()
|
||||||
|
|
||||||
// block if specified
|
// block if specified
|
||||||
|
Loading…
x
Reference in New Issue
Block a user