From a9c1122bcec2a2bb93a91b73a89378e6ce8951b0 Mon Sep 17 00:00:00 2001 From: Alysson Ribeiro <15274059+sonalys@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:28:50 +0100 Subject: [PATCH 1/4] Chore(mocks): update generated mocks --- .../v2/pkg/fixtures/requesterUnexported.go | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go new file mode 100644 index 00000000..381e991d --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go @@ -0,0 +1,64 @@ +// Code generated by mockery. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// requesterUnexported is an autogenerated mock type for the requesterUnexported type +type requesterUnexported struct { + mock.Mock +} + +type requesterUnexported_Expecter struct { + mock *mock.Mock +} + +func (_m *requesterUnexported) EXPECT() *requesterUnexported_Expecter { + return &requesterUnexported_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: +func (_m *requesterUnexported) Get() { + _m.Called() +} + +// requesterUnexported_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type requesterUnexported_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +func (_e *requesterUnexported_Expecter) Get() *requesterUnexported_Get_Call { + return &requesterUnexported_Get_Call{Call: _e.mock.On("Get")} +} + +func (_c *requesterUnexported_Get_Call) Run(run func()) *requesterUnexported_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *requesterUnexported_Get_Call) Return() *requesterUnexported_Get_Call { + _c.Call.Return() + return _c +} + +func (_c *requesterUnexported_Get_Call) RunAndReturn(run func()) *requesterUnexported_Get_Call { + _c.Call.Return(run) + return _c +} + +// newRequesterUnexported creates a new instance of requesterUnexported. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func newRequesterUnexported(t interface { + mock.TestingT + Cleanup(func()) +}) *requesterUnexported { + mock := &requesterUnexported{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} From fe8affbbfb54ef5f8d7736ef2d5dcde1e3b02b3b Mon Sep 17 00:00:00 2001 From: Alysson Ribeiro <15274059+sonalys@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:29:09 +0100 Subject: [PATCH 2/4] Fix(generator): Run functions with empty return --- .../mockery/v2/pkg/TypesPackage_mock.go | 4 +- .../vektra/mockery/v2/pkg/fixtures/A_mock.go | 2 +- .../v2/pkg/fixtures/AsyncProducer_mock.go | 6 +- .../v2/pkg/fixtures/ConsulLock_mock.go | 2 +- .../v2/pkg/fixtures/EmbeddedGet_mock.go | 2 +- .../mockery/v2/pkg/fixtures/EmptyReturn.go | 98 +++++++++++++++++++ .../mockery/v2/pkg/fixtures/Example_mock.go | 2 +- .../ExpecterAndRolledVariadic_mock.go | 4 +- .../mockery/v2/pkg/fixtures/Expecter_mock.go | 4 +- .../mockery/v2/pkg/fixtures/Fooer_mock.go | 2 +- .../v2/pkg/fixtures/GetGeneric_mock.go | 2 +- .../mockery/v2/pkg/fixtures/GetInt_mock.go | 2 +- .../HasConflictingNestedImports_mock.go | 2 +- .../pkg/fixtures/ImportsSameAsPackage_mock.go | 6 +- .../v2/pkg/fixtures/MapToInterface_mock.go | 2 +- .../pkg/fixtures/PanicOnNoReturnValue_mock.go | 2 +- .../pkg/fixtures/ReplaceGenericSelf_mock.go | 2 +- .../v2/pkg/fixtures/ReplaceGeneric_mock.go | 4 +- .../v2/pkg/fixtures/Requester3_mock.go | 2 +- .../v2/pkg/fixtures/Requester4_mock.go | 4 +- .../fixtures/RequesterArgSameAsPkg_mock.go | 2 +- .../v2/pkg/fixtures/RequesterIface_mock.go | 2 +- .../mockery/v2/pkg/fixtures/Sibling_mock.go | 4 +- .../v2/pkg/fixtures/UnsafeInterface_mock.go | 2 +- .../mockery/v2/pkg/fixtures/UsesAny_mock.go | 2 +- .../v2/pkg/fixtures/UsesOtherPkgIface_mock.go | 2 +- .../VariadicNoReturnInterface_mock.go | 2 +- .../IfaceWithCustomBuildTagInComment_mock.go | 4 +- .../v2/pkg/fixtures/requesterUnexported.go | 4 +- pkg/compat_test.go | 32 ++++++ pkg/fixtures/empty_return.go | 6 ++ .../mock_interfaceB_test.go | 2 +- pkg/fixtures/recursive_generation/Foo_mock.go | 2 +- .../recursive_generation/subpkg1/Foo_mock.go | 2 +- .../recursive_generation/subpkg2/Foo_mock.go | 2 +- .../Foo_mock.go | 2 +- pkg/generator.go | 8 ++ 37 files changed, 189 insertions(+), 45 deletions(-) create mode 100644 mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmptyReturn.go create mode 100644 pkg/fixtures/empty_return.go diff --git a/mocks/github.com/vektra/mockery/v2/pkg/TypesPackage_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/TypesPackage_mock.go index dc30f202..c55fc0b5 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/TypesPackage_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/TypesPackage_mock.go @@ -17,7 +17,7 @@ func (_m *TypesPackage) EXPECT() *TypesPackage_Expecter { return &TypesPackage_Expecter{mock: &_m.Mock} } -// Name provides a mock function with given fields: +// Name provides a mock function with no fields func (_m *TypesPackage) Name() string { ret := _m.Called() @@ -62,7 +62,7 @@ func (_c *TypesPackage_Name_Call) RunAndReturn(run func() string) *TypesPackage_ return _c } -// Path provides a mock function with given fields: +// Path provides a mock function with no fields func (_m *TypesPackage) Path() string { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/A_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/A_mock.go index afbdf941..554a332f 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/A_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/A_mock.go @@ -20,7 +20,7 @@ func (_m *A) EXPECT() *A_Expecter { return &A_Expecter{mock: &_m.Mock} } -// Call provides a mock function with given fields: +// Call provides a mock function with no fields func (_m *A) Call() (test.B, error) { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/AsyncProducer_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/AsyncProducer_mock.go index bef64eca..d0021f22 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/AsyncProducer_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/AsyncProducer_mock.go @@ -17,7 +17,7 @@ func (_m *AsyncProducer) EXPECT() *AsyncProducer_Expecter { return &AsyncProducer_Expecter{mock: &_m.Mock} } -// Input provides a mock function with given fields: +// Input provides a mock function with no fields func (_m *AsyncProducer) Input() chan<- bool { ret := _m.Called() @@ -64,7 +64,7 @@ func (_c *AsyncProducer_Input_Call) RunAndReturn(run func() chan<- bool) *AsyncP return _c } -// Output provides a mock function with given fields: +// Output provides a mock function with no fields func (_m *AsyncProducer) Output() <-chan bool { ret := _m.Called() @@ -111,7 +111,7 @@ func (_c *AsyncProducer_Output_Call) RunAndReturn(run func() <-chan bool) *Async return _c } -// Whatever provides a mock function with given fields: +// Whatever provides a mock function with no fields func (_m *AsyncProducer) Whatever() chan bool { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ConsulLock_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ConsulLock_mock.go index 2dfe5dc6..757154be 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ConsulLock_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ConsulLock_mock.go @@ -75,7 +75,7 @@ func (_c *ConsulLock_Lock_Call) RunAndReturn(run func(<-chan struct{}) (<-chan s return _c } -// Unlock provides a mock function with given fields: +// Unlock provides a mock function with no fields func (_m *ConsulLock) Unlock() error { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmbeddedGet_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmbeddedGet_mock.go index a913d106..94df18a5 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmbeddedGet_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmbeddedGet_mock.go @@ -20,7 +20,7 @@ func (_m *EmbeddedGet[T]) EXPECT() *EmbeddedGet_Expecter[T] { return &EmbeddedGet_Expecter[T]{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *EmbeddedGet[T]) Get() T { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmptyReturn.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmptyReturn.go new file mode 100644 index 00000000..37fd97e9 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmptyReturn.go @@ -0,0 +1,98 @@ +// Code generated by mockery. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// EmptyReturn is an autogenerated mock type for the EmptyReturn type +type EmptyReturn struct { + mock.Mock +} + +type EmptyReturn_Expecter struct { + mock *mock.Mock +} + +func (_m *EmptyReturn) EXPECT() *EmptyReturn_Expecter { + return &EmptyReturn_Expecter{mock: &_m.Mock} +} + +// NoArgs provides a mock function with no fields +func (_m *EmptyReturn) NoArgs() { + _m.Called() +} + +// EmptyReturn_NoArgs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NoArgs' +type EmptyReturn_NoArgs_Call struct { + *mock.Call +} + +// NoArgs is a helper method to define mock.On call +func (_e *EmptyReturn_Expecter) NoArgs() *EmptyReturn_NoArgs_Call { + return &EmptyReturn_NoArgs_Call{Call: _e.mock.On("NoArgs")} +} + +func (_c *EmptyReturn_NoArgs_Call) Run(run func()) *EmptyReturn_NoArgs_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *EmptyReturn_NoArgs_Call) Return() *EmptyReturn_NoArgs_Call { + _c.Call.Return() + return _c +} + +func (_c *EmptyReturn_NoArgs_Call) RunAndReturn(run func()) *EmptyReturn_NoArgs_Call { + _c.Run(run) + return _c +} + +// WithArgs provides a mock function with given fields: a, b +func (_m *EmptyReturn) WithArgs(a int, b string) { + _m.Called(a, b) +} + +// EmptyReturn_WithArgs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithArgs' +type EmptyReturn_WithArgs_Call struct { + *mock.Call +} + +// WithArgs is a helper method to define mock.On call +// - a int +// - b string +func (_e *EmptyReturn_Expecter) WithArgs(a interface{}, b interface{}) *EmptyReturn_WithArgs_Call { + return &EmptyReturn_WithArgs_Call{Call: _e.mock.On("WithArgs", a, b)} +} + +func (_c *EmptyReturn_WithArgs_Call) Run(run func(a int, b string)) *EmptyReturn_WithArgs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int), args[1].(string)) + }) + return _c +} + +func (_c *EmptyReturn_WithArgs_Call) Return() *EmptyReturn_WithArgs_Call { + _c.Call.Return() + return _c +} + +func (_c *EmptyReturn_WithArgs_Call) RunAndReturn(run func(int, string)) *EmptyReturn_WithArgs_Call { + _c.Run(run) + return _c +} + +// NewEmptyReturn creates a new instance of EmptyReturn. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewEmptyReturn(t interface { + mock.TestingT + Cleanup(func()) +}) *EmptyReturn { + mock := &EmptyReturn{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Example_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Example_mock.go index 7cfeaae4..72cbf9bc 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Example_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Example_mock.go @@ -24,7 +24,7 @@ func (_m *Example) EXPECT() *Example_Expecter { return &Example_Expecter{mock: &_m.Mock} } -// A provides a mock function with given fields: +// A provides a mock function with no fields func (_m *Example) A() http.Flusher { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ExpecterAndRolledVariadic_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ExpecterAndRolledVariadic_mock.go index 6fd6ffa0..469f09ad 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ExpecterAndRolledVariadic_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ExpecterAndRolledVariadic_mock.go @@ -76,7 +76,7 @@ func (_c *ExpecterAndRolledVariadic_ManyArgsReturns_Call) RunAndReturn(run func( return _c } -// NoArg provides a mock function with given fields: +// NoArg provides a mock function with no fields func (_m *ExpecterAndRolledVariadic) NoArg() string { ret := _m.Called() @@ -150,7 +150,7 @@ func (_c *ExpecterAndRolledVariadic_NoReturn_Call) Return() *ExpecterAndRolledVa } func (_c *ExpecterAndRolledVariadic_NoReturn_Call) RunAndReturn(run func(string)) *ExpecterAndRolledVariadic_NoReturn_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Expecter_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Expecter_mock.go index 2807c78d..7d3c9a26 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Expecter_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Expecter_mock.go @@ -76,7 +76,7 @@ func (_c *Expecter_ManyArgsReturns_Call) RunAndReturn(run func(string, int) ([]s return _c } -// NoArg provides a mock function with given fields: +// NoArg provides a mock function with no fields func (_m *Expecter) NoArg() string { ret := _m.Called() @@ -150,7 +150,7 @@ func (_c *Expecter_NoReturn_Call) Return() *Expecter_NoReturn_Call { } func (_c *Expecter_NoReturn_Call) RunAndReturn(run func(string)) *Expecter_NoReturn_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Fooer_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Fooer_mock.go index c172417b..4e35c74c 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Fooer_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Fooer_mock.go @@ -46,7 +46,7 @@ func (_c *Fooer_Bar_Call) Return() *Fooer_Bar_Call { } func (_c *Fooer_Bar_Call) RunAndReturn(run func(func([]int))) *Fooer_Bar_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetGeneric_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetGeneric_mock.go index 1e31cad1..7c845611 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetGeneric_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetGeneric_mock.go @@ -20,7 +20,7 @@ func (_m *GetGeneric[T]) EXPECT() *GetGeneric_Expecter[T] { return &GetGeneric_Expecter[T]{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *GetGeneric[T]) Get() T { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetInt_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetInt_mock.go index 0eeb3b4f..4bf8d3f4 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetInt_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetInt_mock.go @@ -17,7 +17,7 @@ func (_m *GetInt) EXPECT() *GetInt_Expecter { return &GetInt_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *GetInt) Get() int { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/HasConflictingNestedImports_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/HasConflictingNestedImports_mock.go index 7249de4f..540e229a 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/HasConflictingNestedImports_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/HasConflictingNestedImports_mock.go @@ -79,7 +79,7 @@ func (_c *HasConflictingNestedImports_Get_Call) RunAndReturn(run func(string) (h return _c } -// Z provides a mock function with given fields: +// Z provides a mock function with no fields func (_m *HasConflictingNestedImports) Z() fixtureshttp.MyStruct { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ImportsSameAsPackage_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ImportsSameAsPackage_mock.go index e8045f24..4886e516 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ImportsSameAsPackage_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ImportsSameAsPackage_mock.go @@ -22,7 +22,7 @@ func (_m *ImportsSameAsPackage) EXPECT() *ImportsSameAsPackage_Expecter { return &ImportsSameAsPackage_Expecter{mock: &_m.Mock} } -// A provides a mock function with given fields: +// A provides a mock function with no fields func (_m *ImportsSameAsPackage) A() test.B { ret := _m.Called() @@ -67,7 +67,7 @@ func (_c *ImportsSameAsPackage_A_Call) RunAndReturn(run func() test.B) *ImportsS return _c } -// B provides a mock function with given fields: +// B provides a mock function with no fields func (_m *ImportsSameAsPackage) B() fixtures.KeyManager { ret := _m.Called() @@ -143,7 +143,7 @@ func (_c *ImportsSameAsPackage_C_Call) Return() *ImportsSameAsPackage_C_Call { } func (_c *ImportsSameAsPackage_C_Call) RunAndReturn(run func(fixtures.C)) *ImportsSameAsPackage_C_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MapToInterface_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MapToInterface_mock.go index 7bbb9be3..d68815d9 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MapToInterface_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MapToInterface_mock.go @@ -59,7 +59,7 @@ func (_c *MapToInterface_Foo_Call) Return() *MapToInterface_Foo_Call { } func (_c *MapToInterface_Foo_Call) RunAndReturn(run func(...map[string]interface{})) *MapToInterface_Foo_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/PanicOnNoReturnValue_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/PanicOnNoReturnValue_mock.go index eaa5ea6e..4db1babf 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/PanicOnNoReturnValue_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/PanicOnNoReturnValue_mock.go @@ -17,7 +17,7 @@ func (_m *PanicOnNoReturnValue) EXPECT() *PanicOnNoReturnValue_Expecter { return &PanicOnNoReturnValue_Expecter{mock: &_m.Mock} } -// DoSomething provides a mock function with given fields: +// DoSomething provides a mock function with no fields func (_m *PanicOnNoReturnValue) DoSomething() string { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGenericSelf_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGenericSelf_mock.go index dbd758a4..d12758d2 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGenericSelf_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGenericSelf_mock.go @@ -17,7 +17,7 @@ func (_m *ReplaceGenericSelf) EXPECT() *ReplaceGenericSelf_Expecter { return &ReplaceGenericSelf_Expecter{mock: &_m.Mock} } -// A provides a mock function with given fields: +// A provides a mock function with no fields func (_m *ReplaceGenericSelf) A() *ReplaceGenericSelf { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGeneric_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGeneric_mock.go index 7c37f578..0ac565da 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGeneric_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGeneric_mock.go @@ -70,7 +70,7 @@ func (_c *ReplaceGeneric_A_Call[TConstraint, TKeep]) RunAndReturn(run func(test. return _c } -// B provides a mock function with given fields: +// B provides a mock function with no fields func (_m *ReplaceGeneric[TConstraint, TKeep]) B() test.B { ret := _m.Called() @@ -117,7 +117,7 @@ func (_c *ReplaceGeneric_B_Call[TConstraint, TKeep]) RunAndReturn(run func() tes return _c } -// C provides a mock function with given fields: +// C provides a mock function with no fields func (_m *ReplaceGeneric[TConstraint, TKeep]) C() TConstraint { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester3_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester3_mock.go index 2c18c927..22c23daf 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester3_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester3_mock.go @@ -17,7 +17,7 @@ func (_m *Requester3) EXPECT() *Requester3_Expecter { return &Requester3_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *Requester3) Get() error { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester4_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester4_mock.go index da8d2ced..d77199a0 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester4_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester4_mock.go @@ -17,7 +17,7 @@ func (_m *Requester4) EXPECT() *Requester4_Expecter { return &Requester4_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *Requester4) Get() { _m.Called() } @@ -45,7 +45,7 @@ func (_c *Requester4_Get_Call) Return() *Requester4_Get_Call { } func (_c *Requester4_Get_Call) RunAndReturn(run func()) *Requester4_Get_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsPkg_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsPkg_mock.go index 40218b9d..1da35b17 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsPkg_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsPkg_mock.go @@ -46,7 +46,7 @@ func (_c *RequesterArgSameAsPkg_Get_Call) Return() *RequesterArgSameAsPkg_Get_Ca } func (_c *RequesterArgSameAsPkg_Get_Call) RunAndReturn(run func(string)) *RequesterArgSameAsPkg_Get_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterIface_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterIface_mock.go index 78c73113..2186b6cf 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterIface_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterIface_mock.go @@ -21,7 +21,7 @@ func (_m *RequesterIface) EXPECT() *RequesterIface_Expecter { return &RequesterIface_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *RequesterIface) Get() io.Reader { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Sibling_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Sibling_mock.go index b2baf893..36bebf84 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Sibling_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Sibling_mock.go @@ -17,7 +17,7 @@ func (_m *Sibling) EXPECT() *Sibling_Expecter { return &Sibling_Expecter{mock: &_m.Mock} } -// DoSomething provides a mock function with given fields: +// DoSomething provides a mock function with no fields func (_m *Sibling) DoSomething() { _m.Called() } @@ -45,7 +45,7 @@ func (_c *Sibling_DoSomething_Call) Return() *Sibling_DoSomething_Call { } func (_c *Sibling_DoSomething_Call) RunAndReturn(run func()) *Sibling_DoSomething_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UnsafeInterface_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UnsafeInterface_mock.go index 22116c17..1e46e90b 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UnsafeInterface_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UnsafeInterface_mock.go @@ -50,7 +50,7 @@ func (_c *UnsafeInterface_Do_Call) Return() *UnsafeInterface_Do_Call { } func (_c *UnsafeInterface_Do_Call) RunAndReturn(run func(*unsafe.Pointer)) *UnsafeInterface_Do_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesAny_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesAny_mock.go index 050afa35..b601eac8 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesAny_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesAny_mock.go @@ -17,7 +17,7 @@ func (_m *UsesAny) EXPECT() *UsesAny_Expecter { return &UsesAny_Expecter{mock: &_m.Mock} } -// GetReader provides a mock function with given fields: +// GetReader provides a mock function with no fields func (_m *UsesAny) GetReader() any { ret := _m.Called() diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesOtherPkgIface_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesOtherPkgIface_mock.go index 44228599..aa823c8f 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesOtherPkgIface_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesOtherPkgIface_mock.go @@ -49,7 +49,7 @@ func (_c *UsesOtherPkgIface_DoSomethingElse_Call) Return() *UsesOtherPkgIface_Do } func (_c *UsesOtherPkgIface_DoSomethingElse_Call) RunAndReturn(run func(test.Sibling)) *UsesOtherPkgIface_DoSomethingElse_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/VariadicNoReturnInterface_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/VariadicNoReturnInterface_mock.go index 4a751e0f..ea80e045 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/VariadicNoReturnInterface_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/VariadicNoReturnInterface_mock.go @@ -59,7 +59,7 @@ func (_c *VariadicNoReturnInterface_VariadicNoReturn_Call) Return() *VariadicNoR } func (_c *VariadicNoReturnInterface_VariadicNoReturn_Call) RunAndReturn(run func(int, ...interface{})) *VariadicNoReturnInterface_VariadicNoReturn_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment/IfaceWithCustomBuildTagInComment_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment/IfaceWithCustomBuildTagInComment_mock.go index 73bc3023..148ce91d 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment/IfaceWithCustomBuildTagInComment_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment/IfaceWithCustomBuildTagInComment_mock.go @@ -19,7 +19,7 @@ func (_m *IfaceWithCustomBuildTagInComment) EXPECT() *IfaceWithCustomBuildTagInC return &IfaceWithCustomBuildTagInComment_Expecter{mock: &_m.Mock} } -// Custom2 provides a mock function with given fields: +// Custom2 provides a mock function with no fields func (_m *IfaceWithCustomBuildTagInComment) Custom2() { _m.Called() } @@ -47,7 +47,7 @@ func (_c *IfaceWithCustomBuildTagInComment_Custom2_Call) Return() *IfaceWithCust } func (_c *IfaceWithCustomBuildTagInComment_Custom2_Call) RunAndReturn(run func()) *IfaceWithCustomBuildTagInComment_Custom2_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go index 381e991d..a37c2a35 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go @@ -17,7 +17,7 @@ func (_m *requesterUnexported) EXPECT() *requesterUnexported_Expecter { return &requesterUnexported_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *requesterUnexported) Get() { _m.Called() } @@ -45,7 +45,7 @@ func (_c *requesterUnexported_Get_Call) Return() *requesterUnexported_Get_Call { } func (_c *requesterUnexported_Get_Call) RunAndReturn(run func()) *requesterUnexported_Get_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/pkg/compat_test.go b/pkg/compat_test.go index 385e7d59..c752402b 100644 --- a/pkg/compat_test.go +++ b/pkg/compat_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" mocks "github.com/vektra/mockery/v2/mocks/github.com/vektra/mockery/v2/pkg/fixtures" + test "github.com/vektra/mockery/v2/pkg/fixtures" ) // CompatSuite covers compatibility with github.com/stretchr/testify/mock. @@ -35,6 +36,37 @@ func (s *CompatSuite) TestOnAnythingOfTypeVariadicArgs() { m.AssertCalled(t, "Sprintf", "int: %d string: %s", 22, "twenty two") } +func (s *CompatSuite) TestOnEmptyReturn() { + m := mocks.NewEmptyReturn(s.T()) + var target test.EmptyReturn = m + + s.Run("NoArgs", func() { + run := false + + m.EXPECT().NoArgs().RunAndReturn(func() { + run = true + }) + + target.NoArgs() + + s.True(run) + }) + + s.Run("WithArgs", func() { + run := false + + m.EXPECT().WithArgs(42, "foo").RunAndReturn(func(arg0 int, arg1 string) { + run = true + s.Equal(42, arg0) + s.Equal("foo", arg1) + }) + + target.WithArgs(42, "foo") + + s.True(run) + }) +} + func TestCompatSuite(t *testing.T) { mockcompatSuite := new(CompatSuite) suite.Run(t, mockcompatSuite) diff --git a/pkg/fixtures/empty_return.go b/pkg/fixtures/empty_return.go new file mode 100644 index 00000000..8ece725a --- /dev/null +++ b/pkg/fixtures/empty_return.go @@ -0,0 +1,6 @@ +package test + +type EmptyReturn interface { + NoArgs() + WithArgs(a int, b string) +} diff --git a/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceB_test.go b/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceB_test.go index f0538bd7..cbeff2df 100644 --- a/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceB_test.go +++ b/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceB_test.go @@ -17,7 +17,7 @@ func (_m *interfaceBMock) EXPECT() *interfaceBMock_Expecter { return &interfaceBMock_Expecter{mock: &_m.Mock} } -// GetData provides a mock function with given fields: +// GetData provides a mock function with no fields func (_m *interfaceBMock) GetData() int { ret := _m.Called() diff --git a/pkg/fixtures/recursive_generation/Foo_mock.go b/pkg/fixtures/recursive_generation/Foo_mock.go index 1374b9fa..fbb8fd00 100644 --- a/pkg/fixtures/recursive_generation/Foo_mock.go +++ b/pkg/fixtures/recursive_generation/Foo_mock.go @@ -17,7 +17,7 @@ func (_m *MockFoo) EXPECT() *MockFoo_Expecter { return &MockFoo_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *MockFoo) Get() string { ret := _m.Called() diff --git a/pkg/fixtures/recursive_generation/subpkg1/Foo_mock.go b/pkg/fixtures/recursive_generation/subpkg1/Foo_mock.go index 50697c1d..a4ae0651 100644 --- a/pkg/fixtures/recursive_generation/subpkg1/Foo_mock.go +++ b/pkg/fixtures/recursive_generation/subpkg1/Foo_mock.go @@ -17,7 +17,7 @@ func (_m *MockFoo) EXPECT() *MockFoo_Expecter { return &MockFoo_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *MockFoo) Get() string { ret := _m.Called() diff --git a/pkg/fixtures/recursive_generation/subpkg2/Foo_mock.go b/pkg/fixtures/recursive_generation/subpkg2/Foo_mock.go index fe92d118..eef312d8 100644 --- a/pkg/fixtures/recursive_generation/subpkg2/Foo_mock.go +++ b/pkg/fixtures/recursive_generation/subpkg2/Foo_mock.go @@ -17,7 +17,7 @@ func (_m *MockFoo) EXPECT() *MockFoo_Expecter { return &MockFoo_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *MockFoo) Get() string { ret := _m.Called() diff --git a/pkg/fixtures/recursive_generation/subpkg_with_only_autogenerated_files/Foo_mock.go b/pkg/fixtures/recursive_generation/subpkg_with_only_autogenerated_files/Foo_mock.go index 9648bcfd..b852f2c4 100644 --- a/pkg/fixtures/recursive_generation/subpkg_with_only_autogenerated_files/Foo_mock.go +++ b/pkg/fixtures/recursive_generation/subpkg_with_only_autogenerated_files/Foo_mock.go @@ -17,7 +17,7 @@ func (_m *MockFoo) EXPECT() *MockFoo_Expecter { return &MockFoo_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *MockFoo) Get() string { ret := _m.Called() diff --git a/pkg/generator.go b/pkg/generator.go index ae2ca81d..c5b37a1e 100644 --- a/pkg/generator.go +++ b/pkg/generator.go @@ -856,7 +856,11 @@ func (g *Generator) generateMethod(ctx context.Context, method *Method) { } g.printTemplate(data, ` +{{- if gt (len .Params.Names) 0}} // {{.FunctionName}} provides a mock function with given fields: {{join .Params.Names ", "}} +{{- else}} +// {{.FunctionName}} provides a mock function with no fields +{{- end}} func (_m *{{.MockName}}{{.InstantiatedTypeString}}) {{.FunctionName}}({{join .Params.Params ", "}}) {{if (gt (len .Returns.Types) 1)}}({{end}}{{join .Returns.Types ", "}}{{if (gt (len .Returns.Types) 1)}}){{end}} { {{- .Preamble -}} {{- if not .Returns.Types}} @@ -1010,7 +1014,11 @@ func (_c *{{.CallStruct}}{{ .InstantiatedTypeString }}) Return({{range .Returns. } func (_c *{{.CallStruct}}{{ .InstantiatedTypeString }}) RunAndReturn(run func({{range .Params.Types}}{{.}},{{end}})({{range .Returns.Types}}{{.}},{{end}})) *{{.CallStruct}}{{ .InstantiatedTypeString }} { +{{- if not .Returns.Types}} + _c.Run(run) +{{- else}} _c.Call.Return(run) +{{- end}} return _c } `) From 029a9f99d0454dd7e81ff93586a08970421f6356 Mon Sep 17 00:00:00 2001 From: Alysson Ribeiro <15274059+sonalys@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:34:06 +0100 Subject: [PATCH 3/4] Fix(empty-return): move tests to correct location --- .mockery.yaml | 14 ++- .../mockery/v2/pkg/fixtures/EmptyReturn.go | 98 ------------------- pkg/compat_test.go | 32 ------ .../interface.go} | 0 pkg/fixtures/empty_return/interface_test.go | 38 +++++++ .../empty_return/mock_EmptyReturn_test.go | 98 +++++++++++++++++++ 6 files changed, 147 insertions(+), 133 deletions(-) delete mode 100644 mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmptyReturn.go rename pkg/fixtures/{empty_return.go => empty_return/interface.go} (100%) create mode 100644 pkg/fixtures/empty_return/interface_test.go create mode 100644 pkg/fixtures/empty_return/mock_EmptyReturn_test.go diff --git a/.mockery.yaml b/.mockery.yaml index f3590418..b8442c77 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -70,6 +70,15 @@ packages: mockname: "Mock{{.InterfaceName}}" outpkg: "{{.PackageName}}" inpackage: True + github.com/vektra/mockery/v2/pkg/fixtures/empty_return: + config: + all: True + dir: "{{.InterfaceDir}}" + mockname: "{{.InterfaceName}}Mock" + outpkg: "{{.PackageName}}" + filename: "mock_{{.InterfaceName}}_test.go" + inpackage: True + keeptree: False github.com/vektra/mockery/v2/pkg/fixtures/method_args/same_name_arg_and_type: config: all: True @@ -81,10 +90,10 @@ packages: keeptree: False github.com/vektra/mockery/v2/pkg/fixtures/iface_typed_param: config: *inpackage_config - github.com/vektra/mockery/v2/pkg/fixtures/example_project: + github.com/vektra/mockery/v2/pkg/fixtures/example_project: config: *inpackage_config github.com/vektra/mockery/v2/pkg/fixtures/issue845: - config: + config: <<: *inpackage_config filename: "mock_{{.MockName}}_test.go" interfaces: @@ -108,4 +117,3 @@ packages: mockname: InterfaceWithUnresolvedAlias - resolve-type-alias: True mockname: InterfaceWithResolvedAlias - diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmptyReturn.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmptyReturn.go deleted file mode 100644 index 37fd97e9..00000000 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmptyReturn.go +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// EmptyReturn is an autogenerated mock type for the EmptyReturn type -type EmptyReturn struct { - mock.Mock -} - -type EmptyReturn_Expecter struct { - mock *mock.Mock -} - -func (_m *EmptyReturn) EXPECT() *EmptyReturn_Expecter { - return &EmptyReturn_Expecter{mock: &_m.Mock} -} - -// NoArgs provides a mock function with no fields -func (_m *EmptyReturn) NoArgs() { - _m.Called() -} - -// EmptyReturn_NoArgs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NoArgs' -type EmptyReturn_NoArgs_Call struct { - *mock.Call -} - -// NoArgs is a helper method to define mock.On call -func (_e *EmptyReturn_Expecter) NoArgs() *EmptyReturn_NoArgs_Call { - return &EmptyReturn_NoArgs_Call{Call: _e.mock.On("NoArgs")} -} - -func (_c *EmptyReturn_NoArgs_Call) Run(run func()) *EmptyReturn_NoArgs_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *EmptyReturn_NoArgs_Call) Return() *EmptyReturn_NoArgs_Call { - _c.Call.Return() - return _c -} - -func (_c *EmptyReturn_NoArgs_Call) RunAndReturn(run func()) *EmptyReturn_NoArgs_Call { - _c.Run(run) - return _c -} - -// WithArgs provides a mock function with given fields: a, b -func (_m *EmptyReturn) WithArgs(a int, b string) { - _m.Called(a, b) -} - -// EmptyReturn_WithArgs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithArgs' -type EmptyReturn_WithArgs_Call struct { - *mock.Call -} - -// WithArgs is a helper method to define mock.On call -// - a int -// - b string -func (_e *EmptyReturn_Expecter) WithArgs(a interface{}, b interface{}) *EmptyReturn_WithArgs_Call { - return &EmptyReturn_WithArgs_Call{Call: _e.mock.On("WithArgs", a, b)} -} - -func (_c *EmptyReturn_WithArgs_Call) Run(run func(a int, b string)) *EmptyReturn_WithArgs_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(int), args[1].(string)) - }) - return _c -} - -func (_c *EmptyReturn_WithArgs_Call) Return() *EmptyReturn_WithArgs_Call { - _c.Call.Return() - return _c -} - -func (_c *EmptyReturn_WithArgs_Call) RunAndReturn(run func(int, string)) *EmptyReturn_WithArgs_Call { - _c.Run(run) - return _c -} - -// NewEmptyReturn creates a new instance of EmptyReturn. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewEmptyReturn(t interface { - mock.TestingT - Cleanup(func()) -}) *EmptyReturn { - mock := &EmptyReturn{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/compat_test.go b/pkg/compat_test.go index c752402b..385e7d59 100644 --- a/pkg/compat_test.go +++ b/pkg/compat_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" mocks "github.com/vektra/mockery/v2/mocks/github.com/vektra/mockery/v2/pkg/fixtures" - test "github.com/vektra/mockery/v2/pkg/fixtures" ) // CompatSuite covers compatibility with github.com/stretchr/testify/mock. @@ -36,37 +35,6 @@ func (s *CompatSuite) TestOnAnythingOfTypeVariadicArgs() { m.AssertCalled(t, "Sprintf", "int: %d string: %s", 22, "twenty two") } -func (s *CompatSuite) TestOnEmptyReturn() { - m := mocks.NewEmptyReturn(s.T()) - var target test.EmptyReturn = m - - s.Run("NoArgs", func() { - run := false - - m.EXPECT().NoArgs().RunAndReturn(func() { - run = true - }) - - target.NoArgs() - - s.True(run) - }) - - s.Run("WithArgs", func() { - run := false - - m.EXPECT().WithArgs(42, "foo").RunAndReturn(func(arg0 int, arg1 string) { - run = true - s.Equal(42, arg0) - s.Equal("foo", arg1) - }) - - target.WithArgs(42, "foo") - - s.True(run) - }) -} - func TestCompatSuite(t *testing.T) { mockcompatSuite := new(CompatSuite) suite.Run(t, mockcompatSuite) diff --git a/pkg/fixtures/empty_return.go b/pkg/fixtures/empty_return/interface.go similarity index 100% rename from pkg/fixtures/empty_return.go rename to pkg/fixtures/empty_return/interface.go diff --git a/pkg/fixtures/empty_return/interface_test.go b/pkg/fixtures/empty_return/interface_test.go new file mode 100644 index 00000000..6039d146 --- /dev/null +++ b/pkg/fixtures/empty_return/interface_test.go @@ -0,0 +1,38 @@ +package test + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test(t *testing.T) { + m := NewEmptyReturnMock(t) + var target EmptyReturn = m + + t.Run("NoArgs", func(t *testing.T) { + run := false + + m.EXPECT().NoArgs().RunAndReturn(func() { + run = true + }) + + target.NoArgs() + + require.True(t, run) + }) + + t.Run("WithArgs", func(t *testing.T) { + run := false + + m.EXPECT().WithArgs(42, "foo").RunAndReturn(func(arg0 int, arg1 string) { + run = true + require.Equal(t, 42, arg0) + require.Equal(t, "foo", arg1) + }) + + target.WithArgs(42, "foo") + + require.True(t, run) + }) +} diff --git a/pkg/fixtures/empty_return/mock_EmptyReturn_test.go b/pkg/fixtures/empty_return/mock_EmptyReturn_test.go new file mode 100644 index 00000000..4f086b62 --- /dev/null +++ b/pkg/fixtures/empty_return/mock_EmptyReturn_test.go @@ -0,0 +1,98 @@ +// Code generated by mockery. DO NOT EDIT. + +package test + +import mock "github.com/stretchr/testify/mock" + +// EmptyReturnMock is an autogenerated mock type for the EmptyReturn type +type EmptyReturnMock struct { + mock.Mock +} + +type EmptyReturnMock_Expecter struct { + mock *mock.Mock +} + +func (_m *EmptyReturnMock) EXPECT() *EmptyReturnMock_Expecter { + return &EmptyReturnMock_Expecter{mock: &_m.Mock} +} + +// NoArgs provides a mock function with no fields +func (_m *EmptyReturnMock) NoArgs() { + _m.Called() +} + +// EmptyReturnMock_NoArgs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NoArgs' +type EmptyReturnMock_NoArgs_Call struct { + *mock.Call +} + +// NoArgs is a helper method to define mock.On call +func (_e *EmptyReturnMock_Expecter) NoArgs() *EmptyReturnMock_NoArgs_Call { + return &EmptyReturnMock_NoArgs_Call{Call: _e.mock.On("NoArgs")} +} + +func (_c *EmptyReturnMock_NoArgs_Call) Run(run func()) *EmptyReturnMock_NoArgs_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *EmptyReturnMock_NoArgs_Call) Return() *EmptyReturnMock_NoArgs_Call { + _c.Call.Return() + return _c +} + +func (_c *EmptyReturnMock_NoArgs_Call) RunAndReturn(run func()) *EmptyReturnMock_NoArgs_Call { + _c.Run(run) + return _c +} + +// WithArgs provides a mock function with given fields: a, b +func (_m *EmptyReturnMock) WithArgs(a int, b string) { + _m.Called(a, b) +} + +// EmptyReturnMock_WithArgs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithArgs' +type EmptyReturnMock_WithArgs_Call struct { + *mock.Call +} + +// WithArgs is a helper method to define mock.On call +// - a int +// - b string +func (_e *EmptyReturnMock_Expecter) WithArgs(a interface{}, b interface{}) *EmptyReturnMock_WithArgs_Call { + return &EmptyReturnMock_WithArgs_Call{Call: _e.mock.On("WithArgs", a, b)} +} + +func (_c *EmptyReturnMock_WithArgs_Call) Run(run func(a int, b string)) *EmptyReturnMock_WithArgs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int), args[1].(string)) + }) + return _c +} + +func (_c *EmptyReturnMock_WithArgs_Call) Return() *EmptyReturnMock_WithArgs_Call { + _c.Call.Return() + return _c +} + +func (_c *EmptyReturnMock_WithArgs_Call) RunAndReturn(run func(int, string)) *EmptyReturnMock_WithArgs_Call { + _c.Run(run) + return _c +} + +// NewEmptyReturnMock creates a new instance of EmptyReturnMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewEmptyReturnMock(t interface { + mock.TestingT + Cleanup(func()) +}) *EmptyReturnMock { + mock := &EmptyReturnMock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} From accf40cbb2964e2aee9f62171aead1193451e6b1 Mon Sep 17 00:00:00 2001 From: Alysson Ribeiro <15274059+sonalys@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:44:18 +0100 Subject: [PATCH 4/4] Merge: fix conflicts --- go.sum | 23 ++++--- go.work.sum | 5 +- .../v2/pkg/fixtures/requesterUnexported.go | 64 ------------------- .../pkg/fixtures/requesterUnexported_mock.go | 4 +- .../example_project/mock_root_test.go | 4 +- .../example_project/mock_stringer_test.go | 2 +- .../mock_getter_iface_typed_param_test.go | 2 +- pkg/fixtures/issue845/mock_WithFix_test.go | 2 +- pkg/fixtures/issue845/mock_WithoutFix_test.go | 2 +- .../mock_InterfaceWithResolvedAlias_test.go | 2 +- .../mock_InterfaceWithUnresolvedAlias_test.go | 2 +- 11 files changed, 24 insertions(+), 88 deletions(-) delete mode 100644 mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go diff --git a/go.sum b/go.sum index 82fb2242..ffdbb4b5 100644 --- a/go.sum +++ b/go.sum @@ -104,9 +104,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -258,8 +257,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -310,8 +309,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -350,8 +349,8 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -361,8 +360,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -413,8 +412,8 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/go.work.sum b/go.work.sum index 65d37e98..aeec4354 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1135,7 +1135,7 @@ golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDA golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -1226,6 +1226,7 @@ golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 h1:zf5N6UOrA487eEFacMePxjXAJctxKmyjKUsjA11Uzuk= @@ -1255,7 +1256,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go deleted file mode 100644 index a37c2a35..00000000 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// requesterUnexported is an autogenerated mock type for the requesterUnexported type -type requesterUnexported struct { - mock.Mock -} - -type requesterUnexported_Expecter struct { - mock *mock.Mock -} - -func (_m *requesterUnexported) EXPECT() *requesterUnexported_Expecter { - return &requesterUnexported_Expecter{mock: &_m.Mock} -} - -// Get provides a mock function with no fields -func (_m *requesterUnexported) Get() { - _m.Called() -} - -// requesterUnexported_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' -type requesterUnexported_Get_Call struct { - *mock.Call -} - -// Get is a helper method to define mock.On call -func (_e *requesterUnexported_Expecter) Get() *requesterUnexported_Get_Call { - return &requesterUnexported_Get_Call{Call: _e.mock.On("Get")} -} - -func (_c *requesterUnexported_Get_Call) Run(run func()) *requesterUnexported_Get_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *requesterUnexported_Get_Call) Return() *requesterUnexported_Get_Call { - _c.Call.Return() - return _c -} - -func (_c *requesterUnexported_Get_Call) RunAndReturn(run func()) *requesterUnexported_Get_Call { - _c.Run(run) - return _c -} - -// newRequesterUnexported creates a new instance of requesterUnexported. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func newRequesterUnexported(t interface { - mock.TestingT - Cleanup(func()) -}) *requesterUnexported { - mock := &requesterUnexported{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported_mock.go index 381e991d..a37c2a35 100644 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported_mock.go +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported_mock.go @@ -17,7 +17,7 @@ func (_m *requesterUnexported) EXPECT() *requesterUnexported_Expecter { return &requesterUnexported_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *requesterUnexported) Get() { _m.Called() } @@ -45,7 +45,7 @@ func (_c *requesterUnexported_Get_Call) Return() *requesterUnexported_Get_Call { } func (_c *requesterUnexported_Get_Call) RunAndReturn(run func()) *requesterUnexported_Get_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/pkg/fixtures/example_project/mock_root_test.go b/pkg/fixtures/example_project/mock_root_test.go index 7ab38328..86e93f91 100644 --- a/pkg/fixtures/example_project/mock_root_test.go +++ b/pkg/fixtures/example_project/mock_root_test.go @@ -20,7 +20,7 @@ func (_m *MockRoot) EXPECT() *MockRoot_Expecter { return &MockRoot_Expecter{mock: &_m.Mock} } -// ReturnsFoo provides a mock function with given fields: +// ReturnsFoo provides a mock function with no fields func (_m *MockRoot) ReturnsFoo() (foo.Foo, error) { ret := _m.Called() @@ -106,7 +106,7 @@ func (_c *MockRoot_TakesBaz_Call) Return() *MockRoot_TakesBaz_Call { } func (_c *MockRoot_TakesBaz_Call) RunAndReturn(run func(*foo.Baz)) *MockRoot_TakesBaz_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/pkg/fixtures/example_project/mock_stringer_test.go b/pkg/fixtures/example_project/mock_stringer_test.go index ceeaa277..17bdc579 100644 --- a/pkg/fixtures/example_project/mock_stringer_test.go +++ b/pkg/fixtures/example_project/mock_stringer_test.go @@ -17,7 +17,7 @@ func (_m *MockStringer) EXPECT() *MockStringer_Expecter { return &MockStringer_Expecter{mock: &_m.Mock} } -// String provides a mock function with given fields: +// String provides a mock function with no fields func (_m *MockStringer) String() string { ret := _m.Called() diff --git a/pkg/fixtures/iface_typed_param/mock_getter_iface_typed_param_test.go b/pkg/fixtures/iface_typed_param/mock_getter_iface_typed_param_test.go index 7731d5fd..41a73a02 100644 --- a/pkg/fixtures/iface_typed_param/mock_getter_iface_typed_param_test.go +++ b/pkg/fixtures/iface_typed_param/mock_getter_iface_typed_param_test.go @@ -21,7 +21,7 @@ func (_m *MockGetterIfaceTypedParam[T]) EXPECT() *MockGetterIfaceTypedParam_Expe return &MockGetterIfaceTypedParam_Expecter[T]{mock: &_m.Mock} } -// Get provides a mock function with given fields: +// Get provides a mock function with no fields func (_m *MockGetterIfaceTypedParam[T]) Get() T { ret := _m.Called() diff --git a/pkg/fixtures/issue845/mock_WithFix_test.go b/pkg/fixtures/issue845/mock_WithFix_test.go index 94c06ac7..7fb7068e 100644 --- a/pkg/fixtures/issue845/mock_WithFix_test.go +++ b/pkg/fixtures/issue845/mock_WithFix_test.go @@ -17,7 +17,7 @@ func (_m *WithFix) EXPECT() *WithFix_Expecter { return &WithFix_Expecter{mock: &_m.Mock} } -// Foo provides a mock function with given fields: +// Foo provides a mock function with no fields func (_m *WithFix) Foo() string { ret := _m.Called() diff --git a/pkg/fixtures/issue845/mock_WithoutFix_test.go b/pkg/fixtures/issue845/mock_WithoutFix_test.go index 0cbfaf5d..29f10dc5 100644 --- a/pkg/fixtures/issue845/mock_WithoutFix_test.go +++ b/pkg/fixtures/issue845/mock_WithoutFix_test.go @@ -17,7 +17,7 @@ func (_m *WithoutFix) EXPECT() *WithoutFix_Expecter { return &WithoutFix_Expecter{mock: &_m.Mock} } -// Foo provides a mock function with given fields: +// Foo provides a mock function with no fields func (_m *WithoutFix) Foo() string { ret := _m.Called() diff --git a/pkg/fixtures/type_alias/mock_InterfaceWithResolvedAlias_test.go b/pkg/fixtures/type_alias/mock_InterfaceWithResolvedAlias_test.go index a0594b93..b0e66f34 100644 --- a/pkg/fixtures/type_alias/mock_InterfaceWithResolvedAlias_test.go +++ b/pkg/fixtures/type_alias/mock_InterfaceWithResolvedAlias_test.go @@ -17,7 +17,7 @@ func (_m *InterfaceWithResolvedAlias) EXPECT() *InterfaceWithResolvedAlias_Expec return &InterfaceWithResolvedAlias_Expecter{mock: &_m.Mock} } -// Foo provides a mock function with given fields: +// Foo provides a mock function with no fields func (_m *InterfaceWithResolvedAlias) Foo() int { ret := _m.Called() diff --git a/pkg/fixtures/type_alias/mock_InterfaceWithUnresolvedAlias_test.go b/pkg/fixtures/type_alias/mock_InterfaceWithUnresolvedAlias_test.go index 677b2dbe..4671d850 100644 --- a/pkg/fixtures/type_alias/mock_InterfaceWithUnresolvedAlias_test.go +++ b/pkg/fixtures/type_alias/mock_InterfaceWithUnresolvedAlias_test.go @@ -20,7 +20,7 @@ func (_m *InterfaceWithUnresolvedAlias) EXPECT() *InterfaceWithUnresolvedAlias_E return &InterfaceWithUnresolvedAlias_Expecter{mock: &_m.Mock} } -// Foo provides a mock function with given fields: +// Foo provides a mock function with no fields func (_m *InterfaceWithUnresolvedAlias) Foo() type_alias.Type { ret := _m.Called()