From b49c602f4dd3ef525ccb259685472c7d2956e780 Mon Sep 17 00:00:00 2001 From: Tom Moulard Date: Thu, 2 May 2024 18:36:04 +0200 Subject: [PATCH] feat: support types.Array as interface args --- mocktail.go | 3 + syrup.go | 3 + testdata/exported/a/mock_gen.go.golden | 421 ++++++++++++++++++++++++- testdata/src/a/a.go | 1 + testdata/src/a/mock_gen_test.go | 299 ++++++++++++++++++ testdata/src/a/mock_gen_test.go.golden | 299 ++++++++++++++++++ testdata/src/a/mock_test.go | 2 + 7 files changed, 1020 insertions(+), 8 deletions(-) diff --git a/mocktail.go b/mocktail.go index fc9ef38..c845c5d 100644 --- a/mocktail.go +++ b/mocktail.go @@ -213,6 +213,9 @@ func getTypeImports(t types.Type) []string { case *types.Slice: return getTypeImports(v.Elem()) + case *types.Array: + return getTypeImports(v.Elem()) + case *types.Map: imports := getTypeImports(v.Key()) imports = append(imports, getTypeImports(v.Elem())...) diff --git a/syrup.go b/syrup.go index 3e223ec..12b78b5 100644 --- a/syrup.go +++ b/syrup.go @@ -593,6 +593,9 @@ func (s Syrup) getTypeName(t types.Type, last bool) string { case *types.Chan: return s.getChanTypeName(v) + case *types.Array: + return fmt.Sprintf("[%d]%s", v.Len(), s.getTypeName(v.Elem(), false)) + default: panic(fmt.Sprintf("OOPS %[1]T %[1]s", t)) } diff --git a/testdata/exported/a/mock_gen.go.golden b/testdata/exported/a/mock_gen.go.golden index 87ccce1..b22b976 100644 --- a/testdata/exported/a/mock_gen.go.golden +++ b/testdata/exported/a/mock_gen.go.golden @@ -5,6 +5,7 @@ package a import ( "a/b" "a/c" + "a/e/v2" "bytes" "context" "testing" @@ -17,8 +18,8 @@ import ( // pineappleMock mock of Pineapple. type pineappleMock struct{ mock.Mock } -// NewPineappleMock creates a new pineappleMock. -func NewPineappleMock(tb testing.TB) *pineappleMock { +// newPineappleMock creates a new pineappleMock. +func newPineappleMock(tb testing.TB) *pineappleMock { tb.Helper() m := &pineappleMock{} @@ -647,8 +648,8 @@ func (_c *pineappleWorldCall) OnWorldRaw() *pineappleWorldCall { // coconutMock mock of Coconut. type coconutMock struct{ mock.Mock } -// NewCoconutMock creates a new coconutMock. -func NewCoconutMock(tb testing.TB) *coconutMock { +// newCoconutMock creates a new coconutMock. +func newCoconutMock(tb testing.TB) *coconutMock { tb.Helper() m := &coconutMock{} @@ -778,6 +779,10 @@ func (_c *coconutBooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutBooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutBooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -830,6 +835,10 @@ func (_c *coconutBooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutBooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutBooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -965,6 +974,10 @@ func (_c *coconutDooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutDooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutDooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1017,6 +1030,10 @@ func (_c *coconutDooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutDooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutDooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1152,6 +1169,10 @@ func (_c *coconutFooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutFooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutFooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1204,6 +1225,10 @@ func (_c *coconutFooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutFooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutFooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1339,6 +1364,10 @@ func (_c *coconutGooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutGooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutGooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1391,6 +1420,10 @@ func (_c *coconutGooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutGooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutGooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1510,6 +1543,10 @@ func (_c *coconutHooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutHooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutHooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1562,6 +1599,10 @@ func (_c *coconutHooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutHooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutHooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1700,6 +1741,10 @@ func (_c *coconutJooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutJooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutJooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1752,6 +1797,10 @@ func (_c *coconutJooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutJooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutJooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1887,6 +1936,10 @@ func (_c *coconutKooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutKooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutKooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1939,6 +1992,10 @@ func (_c *coconutKooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutKooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutKooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2075,6 +2132,10 @@ func (_c *coconutLooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutLooCall) OnNoo(ar ...[2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutLooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2127,6 +2188,10 @@ func (_c *coconutLooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutLooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutLooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2262,6 +2327,10 @@ func (_c *coconutMooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutMooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutMooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2314,6 +2383,10 @@ func (_c *coconutMooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutMooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutMooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2330,6 +2403,201 @@ func (_c *coconutMooCall) OnZooRaw(st interface{}) *coconutZooCall { return _c.Parent.OnZooRaw(st) } +func (_m *coconutMock) Noo(ar [][2]string) string { + _ret := _m.Called(ar) + + if _rf, ok := _ret.Get(0).(func([][2]string) string); ok { + return _rf(ar) + } + + _ra0 := _ret.String(0) + + return _ra0 +} + +func (_m *coconutMock) OnNoo(ar [][2]string) *coconutNooCall { + return &coconutNooCall{Call: _m.Mock.On("Noo", ar), Parent: _m} +} + +func (_m *coconutMock) OnNooRaw(ar interface{}) *coconutNooCall { + return &coconutNooCall{Call: _m.Mock.On("Noo", ar), Parent: _m} +} + +type coconutNooCall struct { + *mock.Call + Parent *coconutMock +} + +func (_c *coconutNooCall) Panic(msg string) *coconutNooCall { + _c.Call = _c.Call.Panic(msg) + return _c +} + +func (_c *coconutNooCall) Once() *coconutNooCall { + _c.Call = _c.Call.Once() + return _c +} + +func (_c *coconutNooCall) Twice() *coconutNooCall { + _c.Call = _c.Call.Twice() + return _c +} + +func (_c *coconutNooCall) Times(i int) *coconutNooCall { + _c.Call = _c.Call.Times(i) + return _c +} + +func (_c *coconutNooCall) WaitUntil(w <-chan time.Time) *coconutNooCall { + _c.Call = _c.Call.WaitUntil(w) + return _c +} + +func (_c *coconutNooCall) After(d time.Duration) *coconutNooCall { + _c.Call = _c.Call.After(d) + return _c +} + +func (_c *coconutNooCall) Run(fn func(args mock.Arguments)) *coconutNooCall { + _c.Call = _c.Call.Run(fn) + return _c +} + +func (_c *coconutNooCall) Maybe() *coconutNooCall { + _c.Call = _c.Call.Maybe() + return _c +} + +func (_c *coconutNooCall) TypedReturns(a string) *coconutNooCall { + _c.Call = _c.Return(a) + return _c +} + +func (_c *coconutNooCall) ReturnsFn(fn func([][2]string) string) *coconutNooCall { + _c.Call = _c.Return(fn) + return _c +} + +func (_c *coconutNooCall) TypedRun(fn func([][2]string)) *coconutNooCall { + _c.Call = _c.Call.Run(func(args mock.Arguments) { + _ar, _ := args.Get(0).([][2]string) + fn(_ar) + }) + return _c +} + +func (_c *coconutNooCall) OnBoo(src *bytes.Buffer) *coconutBooCall { + return _c.Parent.OnBoo(src) +} + +func (_c *coconutNooCall) OnDoo(src time.Duration) *coconutDooCall { + return _c.Parent.OnDoo(src) +} + +func (_c *coconutNooCall) OnFoo(st Strawberry) *coconutFooCall { + return _c.Parent.OnFoo(st) +} + +func (_c *coconutNooCall) OnGoo(st string) *coconutGooCall { + return _c.Parent.OnGoo(st) +} + +func (_c *coconutNooCall) OnHoo(aParam string, bParam int, cParam Water) *coconutHooCall { + return _c.Parent.OnHoo(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnJoo(aParam string, bParam int, cParam Water) *coconutJooCall { + return _c.Parent.OnJoo(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnKoo(src string) *coconutKooCall { + return _c.Parent.OnKoo(src) +} + +func (_c *coconutNooCall) OnLoo(st string, values []int) *coconutLooCall { + return _c.Parent.OnLoo(st, values...) +} + +func (_c *coconutNooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coconutMooCall { + return _c.Parent.OnMoo(fn) +} + +func (_c *coconutNooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + +func (_c *coconutNooCall) OnToo(src string) *coconutTooCall { + return _c.Parent.OnToo(src) +} + +func (_c *coconutNooCall) OnVoo(src *module.Version) *coconutVooCall { + return _c.Parent.OnVoo(src) +} + +func (_c *coconutNooCall) OnYoo(st string) *coconutYooCall { + return _c.Parent.OnYoo(st) +} + +func (_c *coconutNooCall) OnZoo(st interface{}) *coconutZooCall { + return _c.Parent.OnZoo(st) +} + +func (_c *coconutNooCall) OnBooRaw(src interface{}) *coconutBooCall { + return _c.Parent.OnBooRaw(src) +} + +func (_c *coconutNooCall) OnDooRaw(src interface{}) *coconutDooCall { + return _c.Parent.OnDooRaw(src) +} + +func (_c *coconutNooCall) OnFooRaw(st interface{}) *coconutFooCall { + return _c.Parent.OnFooRaw(st) +} + +func (_c *coconutNooCall) OnGooRaw(st interface{}) *coconutGooCall { + return _c.Parent.OnGooRaw(st) +} + +func (_c *coconutNooCall) OnHooRaw(aParam interface{}, bParam interface{}, cParam interface{}) *coconutHooCall { + return _c.Parent.OnHooRaw(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnJooRaw(aParam interface{}, bParam interface{}, cParam interface{}) *coconutJooCall { + return _c.Parent.OnJooRaw(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnKooRaw(src interface{}) *coconutKooCall { + return _c.Parent.OnKooRaw(src) +} + +func (_c *coconutNooCall) OnLooRaw(st interface{}, values interface{}) *coconutLooCall { + return _c.Parent.OnLooRaw(st, values) +} + +func (_c *coconutNooCall) OnMooRaw(fn interface{}) *coconutMooCall { + return _c.Parent.OnMooRaw(fn) +} + +func (_c *coconutNooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + +func (_c *coconutNooCall) OnTooRaw(src interface{}) *coconutTooCall { + return _c.Parent.OnTooRaw(src) +} + +func (_c *coconutNooCall) OnVooRaw(src interface{}) *coconutVooCall { + return _c.Parent.OnVooRaw(src) +} + +func (_c *coconutNooCall) OnYooRaw(st interface{}) *coconutYooCall { + return _c.Parent.OnYooRaw(st) +} + +func (_c *coconutNooCall) OnZooRaw(st interface{}) *coconutZooCall { + return _c.Parent.OnZooRaw(st) +} + func (_m *coconutMock) Too(src string) time.Duration { _ret := _m.Called(src) @@ -2449,6 +2717,10 @@ func (_c *coconutTooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutTooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutTooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2501,6 +2773,10 @@ func (_c *coconutTooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutTooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutTooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2636,6 +2912,10 @@ func (_c *coconutVooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutVooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutVooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2688,6 +2968,10 @@ func (_c *coconutVooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutVooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutVooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2823,6 +3107,10 @@ func (_c *coconutYooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutYooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutYooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2875,6 +3163,10 @@ func (_c *coconutYooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutYooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutYooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -3010,6 +3302,10 @@ func (_c *coconutZooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutZooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutZooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -3062,6 +3358,10 @@ func (_c *coconutZooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutZooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutZooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -3081,8 +3381,8 @@ func (_c *coconutZooCall) OnZooRaw(st interface{}) *coconutZooCall { // carrotMock mock of Carrot. type carrotMock struct{ mock.Mock } -// NewCarrotMock creates a new carrotMock. -func NewCarrotMock(tb testing.TB) *carrotMock { +// newCarrotMock creates a new carrotMock. +func newCarrotMock(tb testing.TB) *carrotMock { tb.Helper() m := &carrotMock{} @@ -3294,8 +3594,8 @@ func (_c *carrotBurCall) OnBurRaw(aParam interface{}) *carrotBurCall { // orangeMock mock of Orange. type orangeMock struct{ mock.Mock } -// NewOrangeMock creates a new orangeMock. -func NewOrangeMock(tb testing.TB) *orangeMock { +// newOrangeMock creates a new orangeMock. +func newOrangeMock(tb testing.TB) *orangeMock { tb.Helper() m := &orangeMock{} @@ -3395,3 +3695,108 @@ func (_c *orangeJuiceCall) OnJuice() *orangeJuiceCall { func (_c *orangeJuiceCall) OnJuiceRaw() *orangeJuiceCall { return _c.Parent.OnJuiceRaw() } + +// cherryMock mock of Cherry. +type cherryMock struct{ mock.Mock } + +// newCherryMock creates a new cherryMock. +func newCherryMock(tb testing.TB) *cherryMock { + tb.Helper() + + m := &cherryMock{} + m.Mock.Test(tb) + + tb.Cleanup(func() { m.AssertExpectations(tb) }) + + return m +} + +func (_m *cherryMock) V2Carrot() e.V2Carrot { + _ret := _m.Called() + + if _rf, ok := _ret.Get(0).(func() e.V2Carrot); ok { + return _rf() + } + + _ra0, _ := _ret.Get(0).(e.V2Carrot) + + return _ra0 +} + +func (_m *cherryMock) OnV2Carrot() *cherryV2CarrotCall { + return &cherryV2CarrotCall{Call: _m.Mock.On("V2Carrot"), Parent: _m} +} + +func (_m *cherryMock) OnV2CarrotRaw() *cherryV2CarrotCall { + return &cherryV2CarrotCall{Call: _m.Mock.On("V2Carrot"), Parent: _m} +} + +type cherryV2CarrotCall struct { + *mock.Call + Parent *cherryMock +} + +func (_c *cherryV2CarrotCall) Panic(msg string) *cherryV2CarrotCall { + _c.Call = _c.Call.Panic(msg) + return _c +} + +func (_c *cherryV2CarrotCall) Once() *cherryV2CarrotCall { + _c.Call = _c.Call.Once() + return _c +} + +func (_c *cherryV2CarrotCall) Twice() *cherryV2CarrotCall { + _c.Call = _c.Call.Twice() + return _c +} + +func (_c *cherryV2CarrotCall) Times(i int) *cherryV2CarrotCall { + _c.Call = _c.Call.Times(i) + return _c +} + +func (_c *cherryV2CarrotCall) WaitUntil(w <-chan time.Time) *cherryV2CarrotCall { + _c.Call = _c.Call.WaitUntil(w) + return _c +} + +func (_c *cherryV2CarrotCall) After(d time.Duration) *cherryV2CarrotCall { + _c.Call = _c.Call.After(d) + return _c +} + +func (_c *cherryV2CarrotCall) Run(fn func(args mock.Arguments)) *cherryV2CarrotCall { + _c.Call = _c.Call.Run(fn) + return _c +} + +func (_c *cherryV2CarrotCall) Maybe() *cherryV2CarrotCall { + _c.Call = _c.Call.Maybe() + return _c +} + +func (_c *cherryV2CarrotCall) TypedReturns(a e.V2Carrot) *cherryV2CarrotCall { + _c.Call = _c.Return(a) + return _c +} + +func (_c *cherryV2CarrotCall) ReturnsFn(fn func() e.V2Carrot) *cherryV2CarrotCall { + _c.Call = _c.Return(fn) + return _c +} + +func (_c *cherryV2CarrotCall) TypedRun(fn func()) *cherryV2CarrotCall { + _c.Call = _c.Call.Run(func(args mock.Arguments) { + fn() + }) + return _c +} + +func (_c *cherryV2CarrotCall) OnV2Carrot() *cherryV2CarrotCall { + return _c.Parent.OnV2Carrot() +} + +func (_c *cherryV2CarrotCall) OnV2CarrotRaw() *cherryV2CarrotCall { + return _c.Parent.OnV2CarrotRaw() +} diff --git a/testdata/src/a/a.go b/testdata/src/a/a.go index 99c895e..5b63635 100644 --- a/testdata/src/a/a.go +++ b/testdata/src/a/a.go @@ -30,6 +30,7 @@ type Coconut interface { Yoo(st string) interface{} Zoo(st interface{}) string Moo(fn func(st, stban Strawberry) Pineapple) string + Noo(ar [][2]string) string } type Water struct{} diff --git a/testdata/src/a/mock_gen_test.go b/testdata/src/a/mock_gen_test.go index 7cdce94..b22b976 100644 --- a/testdata/src/a/mock_gen_test.go +++ b/testdata/src/a/mock_gen_test.go @@ -779,6 +779,10 @@ func (_c *coconutBooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutBooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutBooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -831,6 +835,10 @@ func (_c *coconutBooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutBooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutBooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -966,6 +974,10 @@ func (_c *coconutDooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutDooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutDooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1018,6 +1030,10 @@ func (_c *coconutDooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutDooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutDooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1153,6 +1169,10 @@ func (_c *coconutFooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutFooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutFooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1205,6 +1225,10 @@ func (_c *coconutFooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutFooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutFooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1340,6 +1364,10 @@ func (_c *coconutGooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutGooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutGooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1392,6 +1420,10 @@ func (_c *coconutGooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutGooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutGooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1511,6 +1543,10 @@ func (_c *coconutHooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutHooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutHooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1563,6 +1599,10 @@ func (_c *coconutHooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutHooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutHooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1701,6 +1741,10 @@ func (_c *coconutJooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutJooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutJooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1753,6 +1797,10 @@ func (_c *coconutJooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutJooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutJooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1888,6 +1936,10 @@ func (_c *coconutKooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutKooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutKooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1940,6 +1992,10 @@ func (_c *coconutKooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutKooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutKooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2076,6 +2132,10 @@ func (_c *coconutLooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutLooCall) OnNoo(ar ...[2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutLooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2128,6 +2188,10 @@ func (_c *coconutLooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutLooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutLooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2263,6 +2327,10 @@ func (_c *coconutMooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutMooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutMooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2315,6 +2383,10 @@ func (_c *coconutMooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutMooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutMooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2331,6 +2403,201 @@ func (_c *coconutMooCall) OnZooRaw(st interface{}) *coconutZooCall { return _c.Parent.OnZooRaw(st) } +func (_m *coconutMock) Noo(ar [][2]string) string { + _ret := _m.Called(ar) + + if _rf, ok := _ret.Get(0).(func([][2]string) string); ok { + return _rf(ar) + } + + _ra0 := _ret.String(0) + + return _ra0 +} + +func (_m *coconutMock) OnNoo(ar [][2]string) *coconutNooCall { + return &coconutNooCall{Call: _m.Mock.On("Noo", ar), Parent: _m} +} + +func (_m *coconutMock) OnNooRaw(ar interface{}) *coconutNooCall { + return &coconutNooCall{Call: _m.Mock.On("Noo", ar), Parent: _m} +} + +type coconutNooCall struct { + *mock.Call + Parent *coconutMock +} + +func (_c *coconutNooCall) Panic(msg string) *coconutNooCall { + _c.Call = _c.Call.Panic(msg) + return _c +} + +func (_c *coconutNooCall) Once() *coconutNooCall { + _c.Call = _c.Call.Once() + return _c +} + +func (_c *coconutNooCall) Twice() *coconutNooCall { + _c.Call = _c.Call.Twice() + return _c +} + +func (_c *coconutNooCall) Times(i int) *coconutNooCall { + _c.Call = _c.Call.Times(i) + return _c +} + +func (_c *coconutNooCall) WaitUntil(w <-chan time.Time) *coconutNooCall { + _c.Call = _c.Call.WaitUntil(w) + return _c +} + +func (_c *coconutNooCall) After(d time.Duration) *coconutNooCall { + _c.Call = _c.Call.After(d) + return _c +} + +func (_c *coconutNooCall) Run(fn func(args mock.Arguments)) *coconutNooCall { + _c.Call = _c.Call.Run(fn) + return _c +} + +func (_c *coconutNooCall) Maybe() *coconutNooCall { + _c.Call = _c.Call.Maybe() + return _c +} + +func (_c *coconutNooCall) TypedReturns(a string) *coconutNooCall { + _c.Call = _c.Return(a) + return _c +} + +func (_c *coconutNooCall) ReturnsFn(fn func([][2]string) string) *coconutNooCall { + _c.Call = _c.Return(fn) + return _c +} + +func (_c *coconutNooCall) TypedRun(fn func([][2]string)) *coconutNooCall { + _c.Call = _c.Call.Run(func(args mock.Arguments) { + _ar, _ := args.Get(0).([][2]string) + fn(_ar) + }) + return _c +} + +func (_c *coconutNooCall) OnBoo(src *bytes.Buffer) *coconutBooCall { + return _c.Parent.OnBoo(src) +} + +func (_c *coconutNooCall) OnDoo(src time.Duration) *coconutDooCall { + return _c.Parent.OnDoo(src) +} + +func (_c *coconutNooCall) OnFoo(st Strawberry) *coconutFooCall { + return _c.Parent.OnFoo(st) +} + +func (_c *coconutNooCall) OnGoo(st string) *coconutGooCall { + return _c.Parent.OnGoo(st) +} + +func (_c *coconutNooCall) OnHoo(aParam string, bParam int, cParam Water) *coconutHooCall { + return _c.Parent.OnHoo(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnJoo(aParam string, bParam int, cParam Water) *coconutJooCall { + return _c.Parent.OnJoo(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnKoo(src string) *coconutKooCall { + return _c.Parent.OnKoo(src) +} + +func (_c *coconutNooCall) OnLoo(st string, values []int) *coconutLooCall { + return _c.Parent.OnLoo(st, values...) +} + +func (_c *coconutNooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coconutMooCall { + return _c.Parent.OnMoo(fn) +} + +func (_c *coconutNooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + +func (_c *coconutNooCall) OnToo(src string) *coconutTooCall { + return _c.Parent.OnToo(src) +} + +func (_c *coconutNooCall) OnVoo(src *module.Version) *coconutVooCall { + return _c.Parent.OnVoo(src) +} + +func (_c *coconutNooCall) OnYoo(st string) *coconutYooCall { + return _c.Parent.OnYoo(st) +} + +func (_c *coconutNooCall) OnZoo(st interface{}) *coconutZooCall { + return _c.Parent.OnZoo(st) +} + +func (_c *coconutNooCall) OnBooRaw(src interface{}) *coconutBooCall { + return _c.Parent.OnBooRaw(src) +} + +func (_c *coconutNooCall) OnDooRaw(src interface{}) *coconutDooCall { + return _c.Parent.OnDooRaw(src) +} + +func (_c *coconutNooCall) OnFooRaw(st interface{}) *coconutFooCall { + return _c.Parent.OnFooRaw(st) +} + +func (_c *coconutNooCall) OnGooRaw(st interface{}) *coconutGooCall { + return _c.Parent.OnGooRaw(st) +} + +func (_c *coconutNooCall) OnHooRaw(aParam interface{}, bParam interface{}, cParam interface{}) *coconutHooCall { + return _c.Parent.OnHooRaw(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnJooRaw(aParam interface{}, bParam interface{}, cParam interface{}) *coconutJooCall { + return _c.Parent.OnJooRaw(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnKooRaw(src interface{}) *coconutKooCall { + return _c.Parent.OnKooRaw(src) +} + +func (_c *coconutNooCall) OnLooRaw(st interface{}, values interface{}) *coconutLooCall { + return _c.Parent.OnLooRaw(st, values) +} + +func (_c *coconutNooCall) OnMooRaw(fn interface{}) *coconutMooCall { + return _c.Parent.OnMooRaw(fn) +} + +func (_c *coconutNooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + +func (_c *coconutNooCall) OnTooRaw(src interface{}) *coconutTooCall { + return _c.Parent.OnTooRaw(src) +} + +func (_c *coconutNooCall) OnVooRaw(src interface{}) *coconutVooCall { + return _c.Parent.OnVooRaw(src) +} + +func (_c *coconutNooCall) OnYooRaw(st interface{}) *coconutYooCall { + return _c.Parent.OnYooRaw(st) +} + +func (_c *coconutNooCall) OnZooRaw(st interface{}) *coconutZooCall { + return _c.Parent.OnZooRaw(st) +} + func (_m *coconutMock) Too(src string) time.Duration { _ret := _m.Called(src) @@ -2450,6 +2717,10 @@ func (_c *coconutTooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutTooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutTooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2502,6 +2773,10 @@ func (_c *coconutTooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutTooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutTooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2637,6 +2912,10 @@ func (_c *coconutVooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutVooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutVooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2689,6 +2968,10 @@ func (_c *coconutVooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutVooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutVooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2824,6 +3107,10 @@ func (_c *coconutYooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutYooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutYooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2876,6 +3163,10 @@ func (_c *coconutYooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutYooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutYooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -3011,6 +3302,10 @@ func (_c *coconutZooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutZooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutZooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -3063,6 +3358,10 @@ func (_c *coconutZooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutZooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutZooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } diff --git a/testdata/src/a/mock_gen_test.go.golden b/testdata/src/a/mock_gen_test.go.golden index 7cdce94..b22b976 100644 --- a/testdata/src/a/mock_gen_test.go.golden +++ b/testdata/src/a/mock_gen_test.go.golden @@ -779,6 +779,10 @@ func (_c *coconutBooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutBooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutBooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -831,6 +835,10 @@ func (_c *coconutBooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutBooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutBooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -966,6 +974,10 @@ func (_c *coconutDooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutDooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutDooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1018,6 +1030,10 @@ func (_c *coconutDooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutDooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutDooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1153,6 +1169,10 @@ func (_c *coconutFooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutFooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutFooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1205,6 +1225,10 @@ func (_c *coconutFooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutFooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutFooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1340,6 +1364,10 @@ func (_c *coconutGooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutGooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutGooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1392,6 +1420,10 @@ func (_c *coconutGooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutGooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutGooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1511,6 +1543,10 @@ func (_c *coconutHooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutHooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutHooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1563,6 +1599,10 @@ func (_c *coconutHooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutHooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutHooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1701,6 +1741,10 @@ func (_c *coconutJooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutJooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutJooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1753,6 +1797,10 @@ func (_c *coconutJooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutJooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutJooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -1888,6 +1936,10 @@ func (_c *coconutKooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutKooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutKooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -1940,6 +1992,10 @@ func (_c *coconutKooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutKooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutKooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2076,6 +2132,10 @@ func (_c *coconutLooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutLooCall) OnNoo(ar ...[2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutLooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2128,6 +2188,10 @@ func (_c *coconutLooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutLooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutLooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2263,6 +2327,10 @@ func (_c *coconutMooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutMooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutMooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2315,6 +2383,10 @@ func (_c *coconutMooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutMooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutMooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2331,6 +2403,201 @@ func (_c *coconutMooCall) OnZooRaw(st interface{}) *coconutZooCall { return _c.Parent.OnZooRaw(st) } +func (_m *coconutMock) Noo(ar [][2]string) string { + _ret := _m.Called(ar) + + if _rf, ok := _ret.Get(0).(func([][2]string) string); ok { + return _rf(ar) + } + + _ra0 := _ret.String(0) + + return _ra0 +} + +func (_m *coconutMock) OnNoo(ar [][2]string) *coconutNooCall { + return &coconutNooCall{Call: _m.Mock.On("Noo", ar), Parent: _m} +} + +func (_m *coconutMock) OnNooRaw(ar interface{}) *coconutNooCall { + return &coconutNooCall{Call: _m.Mock.On("Noo", ar), Parent: _m} +} + +type coconutNooCall struct { + *mock.Call + Parent *coconutMock +} + +func (_c *coconutNooCall) Panic(msg string) *coconutNooCall { + _c.Call = _c.Call.Panic(msg) + return _c +} + +func (_c *coconutNooCall) Once() *coconutNooCall { + _c.Call = _c.Call.Once() + return _c +} + +func (_c *coconutNooCall) Twice() *coconutNooCall { + _c.Call = _c.Call.Twice() + return _c +} + +func (_c *coconutNooCall) Times(i int) *coconutNooCall { + _c.Call = _c.Call.Times(i) + return _c +} + +func (_c *coconutNooCall) WaitUntil(w <-chan time.Time) *coconutNooCall { + _c.Call = _c.Call.WaitUntil(w) + return _c +} + +func (_c *coconutNooCall) After(d time.Duration) *coconutNooCall { + _c.Call = _c.Call.After(d) + return _c +} + +func (_c *coconutNooCall) Run(fn func(args mock.Arguments)) *coconutNooCall { + _c.Call = _c.Call.Run(fn) + return _c +} + +func (_c *coconutNooCall) Maybe() *coconutNooCall { + _c.Call = _c.Call.Maybe() + return _c +} + +func (_c *coconutNooCall) TypedReturns(a string) *coconutNooCall { + _c.Call = _c.Return(a) + return _c +} + +func (_c *coconutNooCall) ReturnsFn(fn func([][2]string) string) *coconutNooCall { + _c.Call = _c.Return(fn) + return _c +} + +func (_c *coconutNooCall) TypedRun(fn func([][2]string)) *coconutNooCall { + _c.Call = _c.Call.Run(func(args mock.Arguments) { + _ar, _ := args.Get(0).([][2]string) + fn(_ar) + }) + return _c +} + +func (_c *coconutNooCall) OnBoo(src *bytes.Buffer) *coconutBooCall { + return _c.Parent.OnBoo(src) +} + +func (_c *coconutNooCall) OnDoo(src time.Duration) *coconutDooCall { + return _c.Parent.OnDoo(src) +} + +func (_c *coconutNooCall) OnFoo(st Strawberry) *coconutFooCall { + return _c.Parent.OnFoo(st) +} + +func (_c *coconutNooCall) OnGoo(st string) *coconutGooCall { + return _c.Parent.OnGoo(st) +} + +func (_c *coconutNooCall) OnHoo(aParam string, bParam int, cParam Water) *coconutHooCall { + return _c.Parent.OnHoo(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnJoo(aParam string, bParam int, cParam Water) *coconutJooCall { + return _c.Parent.OnJoo(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnKoo(src string) *coconutKooCall { + return _c.Parent.OnKoo(src) +} + +func (_c *coconutNooCall) OnLoo(st string, values []int) *coconutLooCall { + return _c.Parent.OnLoo(st, values...) +} + +func (_c *coconutNooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coconutMooCall { + return _c.Parent.OnMoo(fn) +} + +func (_c *coconutNooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + +func (_c *coconutNooCall) OnToo(src string) *coconutTooCall { + return _c.Parent.OnToo(src) +} + +func (_c *coconutNooCall) OnVoo(src *module.Version) *coconutVooCall { + return _c.Parent.OnVoo(src) +} + +func (_c *coconutNooCall) OnYoo(st string) *coconutYooCall { + return _c.Parent.OnYoo(st) +} + +func (_c *coconutNooCall) OnZoo(st interface{}) *coconutZooCall { + return _c.Parent.OnZoo(st) +} + +func (_c *coconutNooCall) OnBooRaw(src interface{}) *coconutBooCall { + return _c.Parent.OnBooRaw(src) +} + +func (_c *coconutNooCall) OnDooRaw(src interface{}) *coconutDooCall { + return _c.Parent.OnDooRaw(src) +} + +func (_c *coconutNooCall) OnFooRaw(st interface{}) *coconutFooCall { + return _c.Parent.OnFooRaw(st) +} + +func (_c *coconutNooCall) OnGooRaw(st interface{}) *coconutGooCall { + return _c.Parent.OnGooRaw(st) +} + +func (_c *coconutNooCall) OnHooRaw(aParam interface{}, bParam interface{}, cParam interface{}) *coconutHooCall { + return _c.Parent.OnHooRaw(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnJooRaw(aParam interface{}, bParam interface{}, cParam interface{}) *coconutJooCall { + return _c.Parent.OnJooRaw(aParam, bParam, cParam) +} + +func (_c *coconutNooCall) OnKooRaw(src interface{}) *coconutKooCall { + return _c.Parent.OnKooRaw(src) +} + +func (_c *coconutNooCall) OnLooRaw(st interface{}, values interface{}) *coconutLooCall { + return _c.Parent.OnLooRaw(st, values) +} + +func (_c *coconutNooCall) OnMooRaw(fn interface{}) *coconutMooCall { + return _c.Parent.OnMooRaw(fn) +} + +func (_c *coconutNooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + +func (_c *coconutNooCall) OnTooRaw(src interface{}) *coconutTooCall { + return _c.Parent.OnTooRaw(src) +} + +func (_c *coconutNooCall) OnVooRaw(src interface{}) *coconutVooCall { + return _c.Parent.OnVooRaw(src) +} + +func (_c *coconutNooCall) OnYooRaw(st interface{}) *coconutYooCall { + return _c.Parent.OnYooRaw(st) +} + +func (_c *coconutNooCall) OnZooRaw(st interface{}) *coconutZooCall { + return _c.Parent.OnZooRaw(st) +} + func (_m *coconutMock) Too(src string) time.Duration { _ret := _m.Called(src) @@ -2450,6 +2717,10 @@ func (_c *coconutTooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutTooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutTooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2502,6 +2773,10 @@ func (_c *coconutTooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutTooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutTooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2637,6 +2912,10 @@ func (_c *coconutVooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutVooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutVooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2689,6 +2968,10 @@ func (_c *coconutVooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutVooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutVooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -2824,6 +3107,10 @@ func (_c *coconutYooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutYooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutYooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -2876,6 +3163,10 @@ func (_c *coconutYooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutYooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutYooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } @@ -3011,6 +3302,10 @@ func (_c *coconutZooCall) OnMoo(fn func(Strawberry, Strawberry) Pineapple) *coco return _c.Parent.OnMoo(fn) } +func (_c *coconutZooCall) OnNoo(ar [][2]string) *coconutNooCall { + return _c.Parent.OnNoo(ar) +} + func (_c *coconutZooCall) OnToo(src string) *coconutTooCall { return _c.Parent.OnToo(src) } @@ -3063,6 +3358,10 @@ func (_c *coconutZooCall) OnMooRaw(fn interface{}) *coconutMooCall { return _c.Parent.OnMooRaw(fn) } +func (_c *coconutZooCall) OnNooRaw(ar interface{}) *coconutNooCall { + return _c.Parent.OnNooRaw(ar) +} + func (_c *coconutZooCall) OnTooRaw(src interface{}) *coconutTooCall { return _c.Parent.OnTooRaw(src) } diff --git a/testdata/src/a/mock_test.go b/testdata/src/a/mock_test.go index 1db79c8..248ee62 100644 --- a/testdata/src/a/mock_test.go +++ b/testdata/src/a/mock_test.go @@ -34,10 +34,12 @@ func TestName(t *testing.T) { var c Coconut = newCoconutMock(t). OnLoo("a", 1, 2).TypedReturns("foo").Once(). OnMoo(fn).TypedReturns("").Once(). + OnNoo([][2]string{{"a", "b"}}).TypedReturns(""). Parent c.Loo("a", 1, 2) c.Moo(fn) + c.Noo([][2]string{{"a", "b"}}) juiceCh := make(chan struct{}, 1) juiceCh <- struct{}{}