mirror of https://github.com/stretchr/testify.git
Merge pull request #1709 from techfg/chore/issue-1621-update-docs
chore: update docs for Unset #1621pull/1344/merge
commit
1e7fb5865a
11
mock/mock.go
11
mock/mock.go
|
@ -208,9 +208,16 @@ func (c *Call) On(methodName string, arguments ...interface{}) *Call {
|
|||
return c.Parent.On(methodName, arguments...)
|
||||
}
|
||||
|
||||
// Unset removes a mock handler from being called.
|
||||
// Unset removes all mock handlers that satisfy the call instance arguments from being
|
||||
// called. Only supported on call instances with static input arguments.
|
||||
//
|
||||
// test.On("func", mock.Anything).Unset()
|
||||
// For example, the only handler remaining after the following would be "MyMethod(2, 2)":
|
||||
//
|
||||
// Mock.
|
||||
// On("MyMethod", 2, 2).Return(0).
|
||||
// On("MyMethod", 3, 3).Return(0).
|
||||
// On("MyMethod", Anything, Anything).Return(0)
|
||||
// Mock.On("MyMethod", 3, 3).Unset()
|
||||
func (c *Call) Unset() *Call {
|
||||
var unlockOnce sync.Once
|
||||
|
||||
|
|
Loading…
Reference in New Issue