This repository was archived by the owner on Jun 27, 2023. It is now read-only.
Description blow is my codes:
package f
import (
reflect "reflect"
"testing"
"github.com/golang/mock/gomock"
)
type X interface {
Foo (a int , b ... int )
}
func TestX (t * testing.T ) {
ctrl := gomock .NewController (t )
defer ctrl .Finish ()
mockX := NewMockX (ctrl )
mockX .EXPECT ().Foo (100 , 200 , 300 )
mockX .Foo (100 , 300 , 400 )
}
// Code generated by MockGen. DO NOT EDIT.
// Source: x_test.go
// MockX is a mock of X interface
type MockX struct {
ctrl * gomock.Controller
recorder * MockXMockRecorder
}
// MockXMockRecorder is the mock recorder for MockX
type MockXMockRecorder struct {
mock * MockX
}
// NewMockX creates a new mock instance
func NewMockX (ctrl * gomock.Controller ) * MockX {
mock := & MockX {ctrl : ctrl }
mock .recorder = & MockXMockRecorder {mock }
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m * MockX ) EXPECT () * MockXMockRecorder {
return m .recorder
}
// Foo mocks base method
func (m * MockX ) Foo (a int , b ... int ) {
m .ctrl .T .Helper ()
varargs := []interface {}{a }
for _ , a_2 := range b {
varargs = append (varargs , a_2 )
}
m .ctrl .Call (m , "Foo" , varargs ... )
}
// Foo indicates an expected call of Foo
func (mr * MockXMockRecorder ) Foo (a interface {}, b ... interface {}) * gomock.Call {
mr .mock .ctrl .T .Helper ()
varargs := append ([]interface {}{a }, b ... )
return mr .mock .ctrl .RecordCallWithMethodType (mr .mock , "Foo" , reflect .TypeOf ((* MockX )(nil ).Foo ), varargs ... )
}
so I want receive an error message like:
Expected call at .../f/x_test.go:19 doesn't match the argument at index 1.
Got: 300
Want: is equal to 200
but what i actually see is :
Expected call at .../f/x_test.go:19 doesn't match the argument at index 1.
Got: **[300 400]**
Want: is equal to 200
Reactions are currently unavailable