If set return parameters without .Expected for method with arguments, then not call the method - minimock will panic on Finish.
tmp.go
package asd
import "testing"
type Int interface {
M()
MA(i int)
}
func TestExpected(t *testing.T) {
m := NewIntMock(t)
m.MMock.Return()
// Work as expected: fail test because method not called
m.MinimockFinish()
}
func TestNilPanic(t *testing.T) {
m := NewIntMock(t)
m.MAMock.Return() // for method with arguments
// invalid memory address or nil pointer dereference. Bug.
m.MinimockFinish()
}
If set return parameters without .Expected for method with arguments, then not call the method - minimock will panic on Finish.
tmp.go
generated code: https://gist.github.com/rekby/3e95b03c8220cd5da895e8ccaa66bd44