diff --git a/.mockery.yaml b/.mockery.yaml index 85591be29..e71d5d533 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -1,40 +1,36 @@ -mockname: "Mock{{.InterfaceName}}" -filename: "mockery_mock.go" +template: "mockery" +mockname: "{{.InterfaceName}}" +filename: "{{.MockName}}_mock.go" pkgname: mocks tags: "custom2" -issue-845-fix: True -template: "mockery" -boilerplate-file: "./.boilerplate.txt" -mock-build-tags: test _anchors: &inpackage_config all: True dir: "{{.InterfaceDir}}" mockname: "Mock{{.InterfaceName}}" - pkgname: "{{.PackageName}}_test" - filename: "mock_{{.InterfaceNameSnake}}_test.go" + pkgname: "{{.SrcPackageName}}_test" + filename: "mock_{{.InterfaceName | snakecase }}_test.go" packages: - #github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment: - # config: - # mock-build-tags: "custom3 && (!windows || !darwin || !freebsd)" - # disable-version-string: true - # interfaces: - # IfaceWithCustomBuildTagInComment: - #github.com/vektra/mockery/v2/pkg: - # interfaces: - # TypesPackage: + github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment: + config: + mock-build-tags: "custom3 && (!windows || !darwin || !freebsd)" + interfaces: + IfaceWithCustomBuildTagInComment: + github.com/vektra/mockery/v2/pkg: + interfaces: + TypesPackage: github.com/vektra/mockery/v2/pkg/fixtures: config: - all: False + all: True interfaces: - A: - RequesterGenerics: - #RequesterArgSameAsNamedImport: - #RequesterVariadic: - # configs: - # - mockname: RequesterVariadicOneArgument - # unroll-variadic: False - # - mockname: RequesterVariadic - # unroll-variadic: True + RequesterArgSameAsNamedImport: + RequesterVariadic: + configs: + - mockname: RequesterVariadicOneArgument + template-data: + unroll-variadic: False + - mockname: RequesterVariadic + template-data: + unroll-variadic: True Expecter: configs: - mockname: ExpecterAndRolledVariadic @@ -43,57 +39,52 @@ packages: - mockname: Expecter template-data: unroll-variadic: True - #RequesterReturnElided: - #VariadicNoReturnInterface: - # config: - # unroll-variadic: False - #ReplaceGeneric: - #ReplaceGenericSelf: - #github.com/vektra/mockery/v2/pkg/fixtures/recursive_generation: - # config: - # recursive: True - # all: True - # dir: "{{.InterfaceDir}}" - # filename: "{{.InterfaceName}}_mock.go" - # mockname: "Mock{{.InterfaceName}}" - # pkgname: "{{.PackageName}}" - #github.com/vektra/mockery/v2/pkg/fixtures/empty_return: - # config: - # all: True - # dir: "{{.InterfaceDir}}" - # mockname: "{{.InterfaceName}}Mock" - # pkgname: "{{.PackageName}}" - # filename: "mock_{{.InterfaceName}}_test.go" - #github.com/vektra/mockery/v2/pkg/fixtures/method_args/same_name_arg_and_type: - # config: - # all: True - # dir: "{{.InterfaceDir}}" - # mockname: "{{.InterfaceName}}Mock" - # pkgname: "{{.PackageName}}" - # filename: "mock_{{.InterfaceName}}_test.go" - #github.com/vektra/mockery/v2/pkg/fixtures/iface_typed_param: - # config: *inpackage_config - #github.com/vektra/mockery/v2/pkg/fixtures/example_project: - # config: *inpackage_config - #github.com/vektra/mockery/v2/pkg/fixtures/index_list_expr: - # config: *inpackage_config - #github.com/vektra/mockery/v2/pkg/fixtures/iface_new_type: - # config: *inpackage_config - #github.com/vektra/mockery/v2/pkg/fixtures/issue845: - # config: - # <<: *inpackage_config - # filename: "mock_{{.MockName}}_test.go" - # interfaces: - # Interface: - # configs: - # - issue-845-fix: False - # mockname: WithoutFix - # - issue-845-fix: True - # mockname: WithFix - #github.com/vektra/mockery/v2/pkg/fixtures/type_alias: - # config: - # all: True - # dir: "{{.InterfaceDir}}" - # filename: "mock_{{.MockName}}_test.go" - # pkgname: "{{.PackageName}}_test" -# \ No newline at end of file + RequesterReturnElided: + VariadicNoReturnInterface: + config: + template-data: + unroll-variadic: False + github.com/vektra/mockery/v2/pkg/fixtures/recursive_generation: + config: + recursive: True + all: True + dir: "{{.InterfaceDir}}" + filename: "{{.InterfaceName}}_mock.go" + mockname: "Mock{{.InterfaceName}}" + pkgname: "{{.SrcPackageName}}" + github.com/vektra/mockery/v2/pkg/fixtures/empty_return: + config: + all: True + dir: "{{.InterfaceDir}}" + mockname: "{{.InterfaceName}}Mock" + pkgname: "{{.SrcPackageName}}" + filename: "mock_{{.InterfaceName}}_test.go" + github.com/vektra/mockery/v2/pkg/fixtures/method_args/same_name_arg_and_type: + config: + all: True + dir: "{{.InterfaceDir}}" + mockname: "{{.InterfaceName}}Mock" + pkgname: "{{.SrcPackageName}}" + filename: "mock_{{.InterfaceName}}_test.go" + github.com/vektra/mockery/v2/pkg/fixtures/iface_typed_param: + config: *inpackage_config + github.com/vektra/mockery/v2/pkg/fixtures/example_project: + config: *inpackage_config + github.com/vektra/mockery/v2/pkg/fixtures/index_list_expr: + config: *inpackage_config + github.com/vektra/mockery/v2/pkg/fixtures/iface_new_type: + config: *inpackage_config + github.com/vektra/mockery/v2/pkg/fixtures/issue845: + config: + <<: *inpackage_config + filename: "mock_{{.MockName}}_test.go" + interfaces: + Interface: + configs: + - mockname: WithFix + github.com/vektra/mockery/v2/pkg/fixtures/type_alias: + config: + all: True + dir: "{{.InterfaceDir}}" + filename: "mock_{{.MockName}}_test.go" + pkgname: "{{.SrcPackageName}}_test" diff --git a/.mockery_moq.yaml b/.mockery_moq.yaml index 06af6be22..6d9e6b085 100644 --- a/.mockery_moq.yaml +++ b/.mockery_moq.yaml @@ -1,7 +1,7 @@ mockname: "{{.InterfaceName}}Mock" filename: "moq_test.go" template: moq -dir: "mocks/moq/{{.PackagePath}}" +dir: "mocks/moq/{{.SrcPackagePath}}" formatter: "goimports" packages: diff --git a/cmd/mockery.go b/cmd/mockery.go index c5c917d15..cf392e1d5 100644 --- a/cmd/mockery.go +++ b/cmd/mockery.go @@ -16,6 +16,7 @@ import ( "github.com/vektra/mockery/v2/pkg" "github.com/vektra/mockery/v2/pkg/logging" "github.com/vektra/mockery/v2/pkg/stackerr" + "golang.org/x/tools/go/packages" ) var ( @@ -172,14 +173,21 @@ type InterfaceCollection struct { srcPkgPath string outPkgPath string outFilePath *pathlib.Path + srcPkg *packages.Package interfaces []*pkg.Interface } -func NewInterfaceCollection(srcPkgPath string, outPkgPath string, outFilePath *pathlib.Path) *InterfaceCollection { +func NewInterfaceCollection( + srcPkgPath string, + outPkgPath string, + outFilePath *pathlib.Path, + srcPkg *packages.Package, +) *InterfaceCollection { return &InterfaceCollection{ srcPkgPath: srcPkgPath, outPkgPath: outPkgPath, outFilePath: outFilePath, + srcPkg: srcPkg, interfaces: make([]*pkg.Interface, 0), } } @@ -280,7 +288,7 @@ func (r *RootApp) Run() error { return err } for _, ifaceConfig := range ifaceConfigs { - if err := ifaceConfig.ParseTemplates(ctx, iface); err != nil { + if err := ifaceConfig.ParseTemplates(ctx, iface, iface.Pkg); err != nil { log.Err(err).Msg("Can't parse config templates for interface") return err } @@ -296,6 +304,7 @@ func (r *RootApp) Run() error { iface.Pkg.PkgPath, outPkgPath, pathlib.NewPath(ifaceConfig.Dir).Join(ifaceConfig.FileName), + iface.Pkg, ) } mockFileToInterfaces[filePath].Append( @@ -311,13 +320,19 @@ func (r *RootApp) Run() error { } for outFilePath, interfacesInFile := range mockFileToInterfaces { - log.Debug().Int("interfaces-in-file-len", len(interfacesInFile.interfaces)).Msgf("%v", interfacesInFile) + fileLog := log.With().Str("file", outFilePath).Logger() + fileCtx := fileLog.WithContext(ctx) + + fileLog.Debug().Int("interfaces-in-file-len", len(interfacesInFile.interfaces)).Msgf("%v", interfacesInFile) outPkgPath := interfacesInFile.outPkgPath - packageConfig, err := r.Config.GetPackageConfig(ctx, interfacesInFile.srcPkgPath) + packageConfig, err := r.Config.GetPackageConfig(fileCtx, interfacesInFile.srcPkgPath) if err != nil { return err } + if err := packageConfig.ParseTemplates(ctx, nil, interfacesInFile.srcPkg); err != nil { + return err + } generator, err := pkg.NewTemplateGenerator( interfacesInFile.interfaces[0].Pkg, outPkgPath, @@ -328,7 +343,7 @@ func (r *RootApp) Run() error { if err != nil { return err } - templateBytes, err := generator.Generate(ctx, interfacesInFile.interfaces) + templateBytes, err := generator.Generate(fileCtx, interfacesInFile.interfaces) if err != nil { return err } 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 new file mode 100644 index 000000000..e9319abfb --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/A_mock.go @@ -0,0 +1,62 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + test "github.com/vektra/mockery/v2/pkg/fixtures" +) + +// NewA creates a new instance of A. 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 NewA(t interface { + mock.TestingT + Cleanup(func()) +}) *A { + mock := &A{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// A is an autogenerated mock type for the A type +type A struct { + mock.Mock +} + +// Call provides a mock function for the type A +func (_mock *A) Call() (test.B, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Call") + } + + var r0 test.B + var r1 error + if returnFunc, ok := ret.Get(0).(func() (test.B, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() test.B); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(test.B) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type A_expecter struct { + mock *mock.Mock +} + +func (_m *A) EXPECT() *A_expecter { + return &A_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..2b1657537 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/AsyncProducer_mock.go @@ -0,0 +1,92 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewAsyncProducer creates a new instance of AsyncProducer. 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 NewAsyncProducer(t interface { + mock.TestingT + Cleanup(func()) +}) *AsyncProducer { + mock := &AsyncProducer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// AsyncProducer is an autogenerated mock type for the AsyncProducer type +type AsyncProducer struct { + mock.Mock +} + +// Input provides a mock function for the type AsyncProducer +func (_mock *AsyncProducer) Input() chan<- bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Input") + } + + var r0 chan<- bool + if returnFunc, ok := ret.Get(0).(func() chan<- bool); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(chan<- bool) + } + } + return r0 +} + +// Output provides a mock function for the type AsyncProducer +func (_mock *AsyncProducer) Output() <-chan bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Output") + } + + var r0 <-chan bool + if returnFunc, ok := ret.Get(0).(func() <-chan bool); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(<-chan bool) + } + } + return r0 +} + +// Whatever provides a mock function for the type AsyncProducer +func (_mock *AsyncProducer) Whatever() chan bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Whatever") + } + + var r0 chan bool + if returnFunc, ok := ret.Get(0).(func() chan bool); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(chan bool) + } + } + return r0 +} + +type AsyncProducer_expecter struct { + mock *mock.Mock +} + +func (_m *AsyncProducer) EXPECT() *AsyncProducer_expecter { + return &AsyncProducer_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Blank_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Blank_mock.go new file mode 100644 index 000000000..fd673f524 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Blank_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewBlank creates a new instance of Blank. 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 NewBlank(t interface { + mock.TestingT + Cleanup(func()) +}) *Blank { + mock := &Blank{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Blank is an autogenerated mock type for the Blank type +type Blank struct { + mock.Mock +} + +// Create provides a mock function for the type Blank +func (_mock *Blank) Create(x interface{}) error { + ret := _mock.Called(x) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = returnFunc(x) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type Blank_expecter struct { + mock *mock.Mock +} + +func (_m *Blank) EXPECT() *Blank_expecter { + return &Blank_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..283f4d8ee --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ConsulLock_mock.go @@ -0,0 +1,80 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewConsulLock creates a new instance of ConsulLock. 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 NewConsulLock(t interface { + mock.TestingT + Cleanup(func()) +}) *ConsulLock { + mock := &ConsulLock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// ConsulLock is an autogenerated mock type for the ConsulLock type +type ConsulLock struct { + mock.Mock +} + +// Lock provides a mock function for the type ConsulLock +func (_mock *ConsulLock) Lock(valCh <-chan struct{}) (<-chan struct{}, error) { + ret := _mock.Called(valCh) + + if len(ret) == 0 { + panic("no return value specified for Lock") + } + + var r0 <-chan struct{} + var r1 error + if returnFunc, ok := ret.Get(0).(func(<-chan struct{}) (<-chan struct{}, error)); ok { + return returnFunc(valCh) + } + if returnFunc, ok := ret.Get(0).(func(<-chan struct{}) <-chan struct{}); ok { + r0 = returnFunc(valCh) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(<-chan struct{}) + } + } + if returnFunc, ok := ret.Get(1).(func(<-chan struct{}) error); ok { + r1 = returnFunc(valCh) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// Unlock provides a mock function for the type ConsulLock +func (_mock *ConsulLock) Unlock() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Unlock") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +type ConsulLock_expecter struct { + mock *mock.Mock +} + +func (_m *ConsulLock) EXPECT() *ConsulLock_expecter { + return &ConsulLock_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..a4a7e50ae --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/EmbeddedGet_mock.go @@ -0,0 +1,55 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/vektra/mockery/v2/pkg/fixtures/constraints" +) + +// NewEmbeddedGet creates a new instance of EmbeddedGet. 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 NewEmbeddedGet[T constraints.Signed](t interface { + mock.TestingT + Cleanup(func()) +}) *EmbeddedGet[T] { + mock := &EmbeddedGet[T]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// EmbeddedGet is an autogenerated mock type for the EmbeddedGet type +type EmbeddedGet[T constraints.Signed] struct { + mock.Mock +} + +// Get provides a mock function for the type EmbeddedGet +func (_mock *EmbeddedGet[T]) Get() T { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 T + if returnFunc, ok := ret.Get(0).(func() T); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(T) + } + } + return r0 +} + +type EmbeddedGet_expecter[T constraints.Signed] struct { + mock *mock.Mock +} + +func (_m *EmbeddedGet[T]) EXPECT() *EmbeddedGet_expecter[T] { + return &EmbeddedGet_expecter[T]{mock: &_m.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 new file mode 100644 index 000000000..2160afa66 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Example_mock.go @@ -0,0 +1,92 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "net/http" + + mock "github.com/stretchr/testify/mock" + number_dir_http "github.com/vektra/mockery/v2/pkg/fixtures/12345678/http" + my_http "github.com/vektra/mockery/v2/pkg/fixtures/http" +) + +// NewExample creates a new instance of Example. 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 NewExample(t interface { + mock.TestingT + Cleanup(func()) +}) *Example { + mock := &Example{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Example is an autogenerated mock type for the Example type +type Example struct { + mock.Mock +} + +// A provides a mock function for the type Example +func (_mock *Example) A() http.Flusher { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for A") + } + + var r0 http.Flusher + if returnFunc, ok := ret.Get(0).(func() http.Flusher); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(http.Flusher) + } + } + return r0 +} + +// B provides a mock function for the type Example +func (_mock *Example) B(fixtureshttp string) my_http.MyStruct { + ret := _mock.Called(fixtureshttp) + + if len(ret) == 0 { + panic("no return value specified for B") + } + + var r0 my_http.MyStruct + if returnFunc, ok := ret.Get(0).(func(string) my_http.MyStruct); ok { + r0 = returnFunc(fixtureshttp) + } else { + r0 = ret.Get(0).(my_http.MyStruct) + } + return r0 +} + +// C provides a mock function for the type Example +func (_mock *Example) C(fixtureshttp string) number_dir_http.MyStruct { + ret := _mock.Called(fixtureshttp) + + if len(ret) == 0 { + panic("no return value specified for C") + } + + var r0 number_dir_http.MyStruct + if returnFunc, ok := ret.Get(0).(func(string) number_dir_http.MyStruct); ok { + r0 = returnFunc(fixtureshttp) + } else { + r0 = ret.Get(0).(number_dir_http.MyStruct) + } + return r0 +} + +type Example_expecter struct { + mock *mock.Mock +} + +func (_m *Example) EXPECT() *Example_expecter { + return &Example_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..d38257132 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ExpecterAndRolledVariadic_mock.go @@ -0,0 +1,132 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewExpecterAndRolledVariadic creates a new instance of ExpecterAndRolledVariadic. 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 NewExpecterAndRolledVariadic(t interface { + mock.TestingT + Cleanup(func()) +}) *ExpecterAndRolledVariadic { + mock := &ExpecterAndRolledVariadic{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// ExpecterAndRolledVariadic is an autogenerated mock type for the Expecter type +type ExpecterAndRolledVariadic struct { + mock.Mock +} + +// ManyArgsReturns provides a mock function for the type ExpecterAndRolledVariadic +func (_mock *ExpecterAndRolledVariadic) ManyArgsReturns(str string, i int) ([]string, error) { + ret := _mock.Called(str, i) + + if len(ret) == 0 { + panic("no return value specified for ManyArgsReturns") + } + + var r0 []string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string, int) ([]string, error)); ok { + return returnFunc(str, i) + } + if returnFunc, ok := ret.Get(0).(func(string, int) []string); ok { + r0 = returnFunc(str, i) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + if returnFunc, ok := ret.Get(1).(func(string, int) error); ok { + r1 = returnFunc(str, i) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// NoArg provides a mock function for the type ExpecterAndRolledVariadic +func (_mock *ExpecterAndRolledVariadic) NoArg() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for NoArg") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +// NoReturn provides a mock function for the type ExpecterAndRolledVariadic +func (_mock *ExpecterAndRolledVariadic) NoReturn(str string) { + _mock.Called(str) + return +} + +// Variadic provides a mock function for the type ExpecterAndRolledVariadic +func (_mock *ExpecterAndRolledVariadic) Variadic(ints ...int) error { + var tmpRet mock.Arguments + if len(ints) > 0 { + tmpRet = _mock.Called(ints) + } else { + tmpRet = _mock.Called() + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Variadic") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(...int) error); ok { + r0 = returnFunc(ints...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// VariadicMany provides a mock function for the type ExpecterAndRolledVariadic +func (_mock *ExpecterAndRolledVariadic) VariadicMany(i int, a string, intfs ...interface{}) error { + var tmpRet mock.Arguments + if len(intfs) > 0 { + tmpRet = _mock.Called(i, a, intfs) + } else { + tmpRet = _mock.Called(i, a) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for VariadicMany") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(int, string, ...interface{}) error); ok { + r0 = returnFunc(i, a, intfs...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type ExpecterAndRolledVariadic_expecter struct { + mock *mock.Mock +} + +func (_m *ExpecterAndRolledVariadic) EXPECT() *ExpecterAndRolledVariadic_expecter { + return &ExpecterAndRolledVariadic_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..7f515ce08 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Expecter_mock.go @@ -0,0 +1,130 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewExpecter creates a new instance of Expecter. 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 NewExpecter(t interface { + mock.TestingT + Cleanup(func()) +}) *Expecter { + mock := &Expecter{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Expecter is an autogenerated mock type for the Expecter type +type Expecter struct { + mock.Mock +} + +// ManyArgsReturns provides a mock function for the type Expecter +func (_mock *Expecter) ManyArgsReturns(str string, i int) ([]string, error) { + ret := _mock.Called(str, i) + + if len(ret) == 0 { + panic("no return value specified for ManyArgsReturns") + } + + var r0 []string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string, int) ([]string, error)); ok { + return returnFunc(str, i) + } + if returnFunc, ok := ret.Get(0).(func(string, int) []string); ok { + r0 = returnFunc(str, i) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + if returnFunc, ok := ret.Get(1).(func(string, int) error); ok { + r1 = returnFunc(str, i) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// NoArg provides a mock function for the type Expecter +func (_mock *Expecter) NoArg() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for NoArg") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +// NoReturn provides a mock function for the type Expecter +func (_mock *Expecter) NoReturn(str string) { + _mock.Called(str) + return +} + +// Variadic provides a mock function for the type Expecter +func (_mock *Expecter) Variadic(ints ...int) error { + // int + _va := make([]interface{}, len(ints)) + for _i := range ints { + _va[_i] = ints[_i] + } + var _ca []interface{} + _ca = append(_ca, _va...) + ret := _mock.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Variadic") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(...int) error); ok { + r0 = returnFunc(ints...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// VariadicMany provides a mock function for the type Expecter +func (_mock *Expecter) VariadicMany(i int, a string, intfs ...interface{}) error { + var _ca []interface{} + _ca = append(_ca, i, a) + _ca = append(_ca, intfs...) + ret := _mock.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for VariadicMany") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(int, string, ...interface{}) error); ok { + r0 = returnFunc(i, a, intfs...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type Expecter_expecter struct { + mock *mock.Mock +} + +func (_m *Expecter) EXPECT() *Expecter_expecter { + return &Expecter_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..641b58547 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Fooer_mock.go @@ -0,0 +1,77 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewFooer creates a new instance of Fooer. 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 NewFooer(t interface { + mock.TestingT + Cleanup(func()) +}) *Fooer { + mock := &Fooer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Fooer is an autogenerated mock type for the Fooer type +type Fooer struct { + mock.Mock +} + +// Bar provides a mock function for the type Fooer +func (_mock *Fooer) Bar(f func([]int)) { + _mock.Called(f) + return +} + +// Baz provides a mock function for the type Fooer +func (_mock *Fooer) Baz(path string) func(x string) string { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Baz") + } + + var r0 func(x string) string + if returnFunc, ok := ret.Get(0).(func(string) func(x string) string); ok { + r0 = returnFunc(path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(func(x string) string) + } + } + return r0 +} + +// Foo provides a mock function for the type Fooer +func (_mock *Fooer) Foo(f func(x string) string) error { + ret := _mock.Called(f) + + if len(ret) == 0 { + panic("no return value specified for Foo") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(func(x string) string) error); ok { + r0 = returnFunc(f) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type Fooer_expecter struct { + mock *mock.Mock +} + +func (_m *Fooer) EXPECT() *Fooer_expecter { + return &Fooer_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/FuncArgsCollision_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/FuncArgsCollision_mock.go new file mode 100644 index 000000000..ff450671a --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/FuncArgsCollision_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewFuncArgsCollision creates a new instance of FuncArgsCollision. 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 NewFuncArgsCollision(t interface { + mock.TestingT + Cleanup(func()) +}) *FuncArgsCollision { + mock := &FuncArgsCollision{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// FuncArgsCollision is an autogenerated mock type for the FuncArgsCollision type +type FuncArgsCollision struct { + mock.Mock +} + +// Foo provides a mock function for the type FuncArgsCollision +func (_mock *FuncArgsCollision) Foo(ret interface{}) error { + ret := _mock.Called(ret) + + if len(ret) == 0 { + panic("no return value specified for Foo") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = returnFunc(ret) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type FuncArgsCollision_expecter struct { + mock *mock.Mock +} + +func (_m *FuncArgsCollision) EXPECT() *FuncArgsCollision_expecter { + return &FuncArgsCollision_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GenericInterface_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GenericInterface_mock.go new file mode 100644 index 000000000..319e1b3f5 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GenericInterface_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewGenericInterface creates a new instance of GenericInterface. 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 NewGenericInterface[M any](t interface { + mock.TestingT + Cleanup(func()) +}) *GenericInterface[M] { + mock := &GenericInterface[M]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// GenericInterface is an autogenerated mock type for the GenericInterface type +type GenericInterface[M any] struct { + mock.Mock +} + +// Func provides a mock function for the type GenericInterface +func (_mock *GenericInterface[M]) Func(arg *M) int { + ret := _mock.Called(arg) + + if len(ret) == 0 { + panic("no return value specified for Func") + } + + var r0 int + if returnFunc, ok := ret.Get(0).(func(*M) int); ok { + r0 = returnFunc(arg) + } else { + r0 = ret.Get(0).(int) + } + return r0 +} + +type GenericInterface_expecter[M any] struct { + mock *mock.Mock +} + +func (_m *GenericInterface[M]) EXPECT() *GenericInterface_expecter[M] { + return &GenericInterface_expecter[M]{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..7f17b3b87 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetGeneric_mock.go @@ -0,0 +1,55 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/vektra/mockery/v2/pkg/fixtures/constraints" +) + +// NewGetGeneric creates a new instance of GetGeneric. 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 NewGetGeneric[T constraints.Integer](t interface { + mock.TestingT + Cleanup(func()) +}) *GetGeneric[T] { + mock := &GetGeneric[T]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// GetGeneric is an autogenerated mock type for the GetGeneric type +type GetGeneric[T constraints.Integer] struct { + mock.Mock +} + +// Get provides a mock function for the type GetGeneric +func (_mock *GetGeneric[T]) Get() T { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 T + if returnFunc, ok := ret.Get(0).(func() T); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(T) + } + } + return r0 +} + +type GetGeneric_expecter[T constraints.Integer] struct { + mock *mock.Mock +} + +func (_m *GetGeneric[T]) EXPECT() *GetGeneric_expecter[T] { + return &GetGeneric_expecter[T]{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..a2c07dfd5 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/GetInt_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewGetInt creates a new instance of GetInt. 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 NewGetInt(t interface { + mock.TestingT + Cleanup(func()) +}) *GetInt { + mock := &GetInt{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// GetInt is an autogenerated mock type for the GetInt type +type GetInt struct { + mock.Mock +} + +// Get provides a mock function for the type GetInt +func (_mock *GetInt) Get() int { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 int + if returnFunc, ok := ret.Get(0).(func() int); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(int) + } + return r0 +} + +type GetInt_expecter struct { + mock *mock.Mock +} + +func (_m *GetInt) EXPECT() *GetInt_expecter { + return &GetInt_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..cc38ebe7e --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/HasConflictingNestedImports_mock.go @@ -0,0 +1,81 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "net/http" + + mock "github.com/stretchr/testify/mock" + my_http "github.com/vektra/mockery/v2/pkg/fixtures/http" +) + +// NewHasConflictingNestedImports creates a new instance of HasConflictingNestedImports. 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 NewHasConflictingNestedImports(t interface { + mock.TestingT + Cleanup(func()) +}) *HasConflictingNestedImports { + mock := &HasConflictingNestedImports{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// HasConflictingNestedImports is an autogenerated mock type for the HasConflictingNestedImports type +type HasConflictingNestedImports struct { + mock.Mock +} + +// Get provides a mock function for the type HasConflictingNestedImports +func (_mock *HasConflictingNestedImports) Get(path string) (http.Response, error) { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 http.Response + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (http.Response, error)); ok { + return returnFunc(path) + } + if returnFunc, ok := ret.Get(0).(func(string) http.Response); ok { + r0 = returnFunc(path) + } else { + r0 = ret.Get(0).(http.Response) + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(path) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// Z provides a mock function for the type HasConflictingNestedImports +func (_mock *HasConflictingNestedImports) Z() my_http.MyStruct { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Z") + } + + var r0 my_http.MyStruct + if returnFunc, ok := ret.Get(0).(func() my_http.MyStruct); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(my_http.MyStruct) + } + return r0 +} + +type HasConflictingNestedImports_expecter struct { + mock *mock.Mock +} + +func (_m *HasConflictingNestedImports) EXPECT() *HasConflictingNestedImports_expecter { + return &HasConflictingNestedImports_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..4131a03d2 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ImportsSameAsPackage_mock.go @@ -0,0 +1,79 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + fixtures "github.com/vektra/mockery/v2/pkg/fixtures" + redefinedtypeb "github.com/vektra/mockery/v2/pkg/fixtures/redefined_type_b" +) + +// NewImportsSameAsPackage creates a new instance of ImportsSameAsPackage. 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 NewImportsSameAsPackage(t interface { + mock.TestingT + Cleanup(func()) +}) *ImportsSameAsPackage { + mock := &ImportsSameAsPackage{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// ImportsSameAsPackage is an autogenerated mock type for the ImportsSameAsPackage type +type ImportsSameAsPackage struct { + mock.Mock +} + +// A provides a mock function for the type ImportsSameAsPackage +func (_mock *ImportsSameAsPackage) A() redefinedtypeb.B { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for A") + } + + var r0 redefinedtypeb.B + if returnFunc, ok := ret.Get(0).(func() redefinedtypeb.B); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(redefinedtypeb.B) + } + return r0 +} + +// B provides a mock function for the type ImportsSameAsPackage +func (_mock *ImportsSameAsPackage) B() fixtures.KeyManager { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for B") + } + + var r0 fixtures.KeyManager + if returnFunc, ok := ret.Get(0).(func() fixtures.KeyManager); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(fixtures.KeyManager) + } + } + return r0 +} + +// C provides a mock function for the type ImportsSameAsPackage +func (_mock *ImportsSameAsPackage) C(c fixtures.C) { + _mock.Called(c) + return +} + +type ImportsSameAsPackage_expecter struct { + mock *mock.Mock +} + +func (_m *ImportsSameAsPackage) EXPECT() *ImportsSameAsPackage_expecter { + return &ImportsSameAsPackage_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/InstantiatedGenericInterface_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/InstantiatedGenericInterface_mock.go new file mode 100644 index 000000000..0ae1b3e6a --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/InstantiatedGenericInterface_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewInstantiatedGenericInterface creates a new instance of InstantiatedGenericInterface. 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 NewInstantiatedGenericInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *InstantiatedGenericInterface { + mock := &InstantiatedGenericInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// InstantiatedGenericInterface is an autogenerated mock type for the InstantiatedGenericInterface type +type InstantiatedGenericInterface struct { + mock.Mock +} + +// Func provides a mock function for the type InstantiatedGenericInterface +func (_mock *InstantiatedGenericInterface) Func(arg *float32) int { + ret := _mock.Called(arg) + + if len(ret) == 0 { + panic("no return value specified for Func") + } + + var r0 int + if returnFunc, ok := ret.Get(0).(func(*float32) int); ok { + r0 = returnFunc(arg) + } else { + r0 = ret.Get(0).(int) + } + return r0 +} + +type InstantiatedGenericInterface_expecter struct { + mock *mock.Mock +} + +func (_m *InstantiatedGenericInterface) EXPECT() *InstantiatedGenericInterface_expecter { + return &InstantiatedGenericInterface_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Issue766_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Issue766_mock.go new file mode 100644 index 000000000..cf3e660bd --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Issue766_mock.go @@ -0,0 +1,63 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewIssue766 creates a new instance of Issue766. 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 NewIssue766(t interface { + mock.TestingT + Cleanup(func()) +}) *Issue766 { + mock := &Issue766{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Issue766 is an autogenerated mock type for the Issue766 type +type Issue766 struct { + mock.Mock +} + +// FetchData provides a mock function for the type Issue766 +func (_mock *Issue766) FetchData(fetchFunc func(x ...int) ([]int, error)) ([]int, error) { + ret := _mock.Called(fetchFunc) + + if len(ret) == 0 { + panic("no return value specified for FetchData") + } + + var r0 []int + var r1 error + if returnFunc, ok := ret.Get(0).(func(func(x ...int) ([]int, error)) ([]int, error)); ok { + return returnFunc(fetchFunc) + } + if returnFunc, ok := ret.Get(0).(func(func(x ...int) ([]int, error)) []int); ok { + r0 = returnFunc(fetchFunc) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]int) + } + } + if returnFunc, ok := ret.Get(1).(func(func(x ...int) ([]int, error)) error); ok { + r1 = returnFunc(fetchFunc) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type Issue766_expecter struct { + mock *mock.Mock +} + +func (_m *Issue766) EXPECT() *Issue766_expecter { + return &Issue766_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/KeyManager_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/KeyManager_mock.go new file mode 100644 index 000000000..2c119c6ae --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/KeyManager_mock.go @@ -0,0 +1,66 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + test "github.com/vektra/mockery/v2/pkg/fixtures" +) + +// NewKeyManager creates a new instance of KeyManager. 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 NewKeyManager(t interface { + mock.TestingT + Cleanup(func()) +}) *KeyManager { + mock := &KeyManager{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// KeyManager is an autogenerated mock type for the KeyManager type +type KeyManager struct { + mock.Mock +} + +// GetKey provides a mock function for the type KeyManager +func (_mock *KeyManager) GetKey(s string, v uint16) ([]byte, *test.Err) { + ret := _mock.Called(s, v) + + if len(ret) == 0 { + panic("no return value specified for GetKey") + } + + var r0 []byte + var r1 *test.Err + if returnFunc, ok := ret.Get(0).(func(string, uint16) ([]byte, *test.Err)); ok { + return returnFunc(s, v) + } + if returnFunc, ok := ret.Get(0).(func(string, uint16) []byte); ok { + r0 = returnFunc(s, v) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + if returnFunc, ok := ret.Get(1).(func(string, uint16) *test.Err); ok { + r1 = returnFunc(s, v) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*test.Err) + } + } + return r0, r1 +} + +type KeyManager_expecter struct { + mock *mock.Mock +} + +func (_m *KeyManager) EXPECT() *KeyManager_expecter { + return &KeyManager_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MapFunc_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MapFunc_mock.go new file mode 100644 index 000000000..3419c7200 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MapFunc_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMapFunc creates a new instance of MapFunc. 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 NewMapFunc(t interface { + mock.TestingT + Cleanup(func()) +}) *MapFunc { + mock := &MapFunc{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MapFunc is an autogenerated mock type for the MapFunc type +type MapFunc struct { + mock.Mock +} + +// Get provides a mock function for the type MapFunc +func (_mock *MapFunc) Get(m map[string]func(string) string) error { + ret := _mock.Called(m) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(map[string]func(string) string) error); ok { + r0 = returnFunc(m) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type MapFunc_expecter struct { + mock *mock.Mock +} + +func (_m *MapFunc) EXPECT() *MapFunc_expecter { + return &MapFunc_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..5758294c0 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MapToInterface_mock.go @@ -0,0 +1,45 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMapToInterface creates a new instance of MapToInterface. 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 NewMapToInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MapToInterface { + mock := &MapToInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MapToInterface is an autogenerated mock type for the MapToInterface type +type MapToInterface struct { + mock.Mock +} + +// Foo provides a mock function for the type MapToInterface +func (_mock *MapToInterface) Foo(arg1 ...map[string]interface{}) { + if len(arg1) > 0 { + _mock.Called(arg1) + } else { + _mock.Called() + } + return +} + +type MapToInterface_expecter struct { + mock *mock.Mock +} + +func (_m *MapToInterface) EXPECT() *MapToInterface_expecter { + return &MapToInterface_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MyReader_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MyReader_mock.go new file mode 100644 index 000000000..9dca214f9 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/MyReader_mock.go @@ -0,0 +1,61 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMyReader creates a new instance of MyReader. 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 NewMyReader(t interface { + mock.TestingT + Cleanup(func()) +}) *MyReader { + mock := &MyReader{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MyReader is an autogenerated mock type for the MyReader type +type MyReader struct { + mock.Mock +} + +// Read provides a mock function for the type MyReader +func (_mock *MyReader) Read(p []byte) (int, error) { + ret := _mock.Called(p) + + if len(ret) == 0 { + panic("no return value specified for Read") + } + + var r0 int + var r1 error + if returnFunc, ok := ret.Get(0).(func([]byte) (int, error)); ok { + return returnFunc(p) + } + if returnFunc, ok := ret.Get(0).(func([]byte) int); ok { + r0 = returnFunc(p) + } else { + r0 = ret.Get(0).(int) + } + if returnFunc, ok := ret.Get(1).(func([]byte) error); ok { + r1 = returnFunc(p) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type MyReader_expecter struct { + mock *mock.Mock +} + +func (_m *MyReader) EXPECT() *MyReader_expecter { + return &MyReader_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..93640f6bd --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/PanicOnNoReturnValue_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewPanicOnNoReturnValue creates a new instance of PanicOnNoReturnValue. 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 NewPanicOnNoReturnValue(t interface { + mock.TestingT + Cleanup(func()) +}) *PanicOnNoReturnValue { + mock := &PanicOnNoReturnValue{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// PanicOnNoReturnValue is an autogenerated mock type for the PanicOnNoReturnValue type +type PanicOnNoReturnValue struct { + mock.Mock +} + +// DoSomething provides a mock function for the type PanicOnNoReturnValue +func (_mock *PanicOnNoReturnValue) DoSomething() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for DoSomething") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type PanicOnNoReturnValue_expecter struct { + mock *mock.Mock +} + +func (_m *PanicOnNoReturnValue) EXPECT() *PanicOnNoReturnValue_expecter { + return &PanicOnNoReturnValue_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..18b6fb816 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGenericSelf_mock.go @@ -0,0 +1,54 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewReplaceGenericSelf creates a new instance of ReplaceGenericSelf. 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 NewReplaceGenericSelf[T any](t interface { + mock.TestingT + Cleanup(func()) +}) *ReplaceGenericSelf[T] { + mock := &ReplaceGenericSelf[T]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// ReplaceGenericSelf is an autogenerated mock type for the ReplaceGenericSelf type +type ReplaceGenericSelf[T any] struct { + mock.Mock +} + +// A provides a mock function for the type ReplaceGenericSelf +func (_mock *ReplaceGenericSelf[T]) A() T { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for A") + } + + var r0 T + if returnFunc, ok := ret.Get(0).(func() T); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(T) + } + } + return r0 +} + +type ReplaceGenericSelf_expecter[T any] struct { + mock *mock.Mock +} + +func (_m *ReplaceGenericSelf[T]) EXPECT() *ReplaceGenericSelf_expecter[T] { + return &ReplaceGenericSelf_expecter[T]{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..689ef60eb --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/ReplaceGeneric_mock.go @@ -0,0 +1,93 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/vektra/mockery/v2/pkg/fixtures/constraints" +) + +// NewReplaceGeneric creates a new instance of ReplaceGeneric. 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 NewReplaceGeneric[TImport any, TConstraint constraints.Signed, TKeep any](t interface { + mock.TestingT + Cleanup(func()) +}) *ReplaceGeneric[TImport, TConstraint, TKeep] { + mock := &ReplaceGeneric[TImport, TConstraint, TKeep]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// ReplaceGeneric is an autogenerated mock type for the ReplaceGeneric type +type ReplaceGeneric[TImport any, TConstraint constraints.Signed, TKeep any] struct { + mock.Mock +} + +// A provides a mock function for the type ReplaceGeneric +func (_mock *ReplaceGeneric[TImport, TConstraint, TKeep]) A(t1 TImport) TKeep { + ret := _mock.Called(t1) + + if len(ret) == 0 { + panic("no return value specified for A") + } + + var r0 TKeep + if returnFunc, ok := ret.Get(0).(func(TImport) TKeep); ok { + r0 = returnFunc(t1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(TKeep) + } + } + return r0 +} + +// B provides a mock function for the type ReplaceGeneric +func (_mock *ReplaceGeneric[TImport, TConstraint, TKeep]) B() TImport { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for B") + } + + var r0 TImport + if returnFunc, ok := ret.Get(0).(func() TImport); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(TImport) + } + } + return r0 +} + +// C provides a mock function for the type ReplaceGeneric +func (_mock *ReplaceGeneric[TImport, TConstraint, TKeep]) C() TConstraint { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for C") + } + + var r0 TConstraint + if returnFunc, ok := ret.Get(0).(func() TConstraint); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(TConstraint) + } + } + return r0 +} + +type ReplaceGeneric_expecter[TImport any, TConstraint constraints.Signed, TKeep any] struct { + mock *mock.Mock +} + +func (_m *ReplaceGeneric[TImport, TConstraint, TKeep]) EXPECT() *ReplaceGeneric_expecter[TImport, TConstraint, TKeep] { + return &ReplaceGeneric_expecter[TImport, TConstraint, TKeep]{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester2_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester2_mock.go new file mode 100644 index 000000000..4c599430f --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester2_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequester2 creates a new instance of Requester2. 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 NewRequester2(t interface { + mock.TestingT + Cleanup(func()) +}) *Requester2 { + mock := &Requester2{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Requester2 is an autogenerated mock type for the Requester2 type +type Requester2 struct { + mock.Mock +} + +// Get provides a mock function for the type Requester2 +func (_mock *Requester2) Get(path string) error { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(string) error); ok { + r0 = returnFunc(path) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type Requester2_expecter struct { + mock *mock.Mock +} + +func (_m *Requester2) EXPECT() *Requester2_expecter { + return &Requester2_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..69b197aef --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester3_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequester3 creates a new instance of Requester3. 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 NewRequester3(t interface { + mock.TestingT + Cleanup(func()) +}) *Requester3 { + mock := &Requester3{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Requester3 is an autogenerated mock type for the Requester3 type +type Requester3 struct { + mock.Mock +} + +// Get provides a mock function for the type Requester3 +func (_mock *Requester3) Get() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +type Requester3_expecter struct { + mock *mock.Mock +} + +func (_m *Requester3) EXPECT() *Requester3_expecter { + return &Requester3_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..e2b5fdb61 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester4_mock.go @@ -0,0 +1,41 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequester4 creates a new instance of Requester4. 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 NewRequester4(t interface { + mock.TestingT + Cleanup(func()) +}) *Requester4 { + mock := &Requester4{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Requester4 is an autogenerated mock type for the Requester4 type +type Requester4 struct { + mock.Mock +} + +// Get provides a mock function for the type Requester4 +func (_mock *Requester4) Get() { + _mock.Called() + return +} + +type Requester4_expecter struct { + mock *mock.Mock +} + +func (_m *Requester4) EXPECT() *Requester4_expecter { + return &Requester4_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsImport_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsImport_mock.go new file mode 100644 index 000000000..882112309 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsImport_mock.go @@ -0,0 +1,56 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "encoding/json" + + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterArgSameAsImport creates a new instance of RequesterArgSameAsImport. 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 NewRequesterArgSameAsImport(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterArgSameAsImport { + mock := &RequesterArgSameAsImport{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterArgSameAsImport is an autogenerated mock type for the RequesterArgSameAsImport type +type RequesterArgSameAsImport struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterArgSameAsImport +func (_mock *RequesterArgSameAsImport) Get(jsonMoqParam string) *json.RawMessage { + ret := _mock.Called(jsonMoqParam) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *json.RawMessage + if returnFunc, ok := ret.Get(0).(func(string) *json.RawMessage); ok { + r0 = returnFunc(jsonMoqParam) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*json.RawMessage) + } + } + return r0 +} + +type RequesterArgSameAsImport_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterArgSameAsImport) EXPECT() *RequesterArgSameAsImport_expecter { + return &RequesterArgSameAsImport_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsNamedImport_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsNamedImport_mock.go new file mode 100644 index 000000000..6872b8244 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsNamedImport_mock.go @@ -0,0 +1,56 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "encoding/json" + + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterArgSameAsNamedImport creates a new instance of RequesterArgSameAsNamedImport. 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 NewRequesterArgSameAsNamedImport(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterArgSameAsNamedImport { + mock := &RequesterArgSameAsNamedImport{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterArgSameAsNamedImport is an autogenerated mock type for the RequesterArgSameAsNamedImport type +type RequesterArgSameAsNamedImport struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterArgSameAsNamedImport +func (_mock *RequesterArgSameAsNamedImport) Get(jsonMoqParam string) *json.RawMessage { + ret := _mock.Called(jsonMoqParam) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *json.RawMessage + if returnFunc, ok := ret.Get(0).(func(string) *json.RawMessage); ok { + r0 = returnFunc(jsonMoqParam) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*json.RawMessage) + } + } + return r0 +} + +type RequesterArgSameAsNamedImport_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterArgSameAsNamedImport) EXPECT() *RequesterArgSameAsNamedImport_expecter { + return &RequesterArgSameAsNamedImport_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..6b337e56d --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArgSameAsPkg_mock.go @@ -0,0 +1,41 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterArgSameAsPkg creates a new instance of RequesterArgSameAsPkg. 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 NewRequesterArgSameAsPkg(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterArgSameAsPkg { + mock := &RequesterArgSameAsPkg{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterArgSameAsPkg is an autogenerated mock type for the RequesterArgSameAsPkg type +type RequesterArgSameAsPkg struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterArgSameAsPkg +func (_mock *RequesterArgSameAsPkg) Get(test string) { + _mock.Called(test) + return +} + +type RequesterArgSameAsPkg_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterArgSameAsPkg) EXPECT() *RequesterArgSameAsPkg_expecter { + return &RequesterArgSameAsPkg_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArray_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArray_mock.go new file mode 100644 index 000000000..f154c2f4c --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterArray_mock.go @@ -0,0 +1,63 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterArray creates a new instance of RequesterArray. 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 NewRequesterArray(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterArray { + mock := &RequesterArray{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterArray is an autogenerated mock type for the RequesterArray type +type RequesterArray struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterArray +func (_mock *RequesterArray) Get(path string) ([2]string, error) { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 [2]string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) ([2]string, error)); ok { + return returnFunc(path) + } + if returnFunc, ok := ret.Get(0).(func(string) [2]string); ok { + r0 = returnFunc(path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([2]string) + } + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(path) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type RequesterArray_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterArray) EXPECT() *RequesterArray_expecter { + return &RequesterArray_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterElided_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterElided_mock.go new file mode 100644 index 000000000..1fb5258c6 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterElided_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterElided creates a new instance of RequesterElided. 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 NewRequesterElided(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterElided { + mock := &RequesterElided{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterElided is an autogenerated mock type for the RequesterElided type +type RequesterElided struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterElided +func (_mock *RequesterElided) Get(path string, url string) error { + ret := _mock.Called(path, url) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(string, string) error); ok { + r0 = returnFunc(path, url) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type RequesterElided_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterElided) EXPECT() *RequesterElided_expecter { + return &RequesterElided_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterGenerics_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterGenerics_mock.go new file mode 100644 index 000000000..eba1d00f1 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterGenerics_mock.go @@ -0,0 +1,120 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "io" + + mock "github.com/stretchr/testify/mock" + test "github.com/vektra/mockery/v2/pkg/fixtures" + "github.com/vektra/mockery/v2/pkg/fixtures/constraints" +) + +// NewRequesterGenerics creates a new instance of RequesterGenerics. 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 NewRequesterGenerics[TAny any, TComparable comparable, TSigned constraints.Signed, TIntf test.GetInt, TExternalIntf io.Writer, TGenIntf test.GetGeneric[TSigned], TInlineType interface{ ~int | ~uint }, TInlineTypeGeneric interface { + ~int | test.GenericType[int, test.GetInt] + comparable +}](t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric] { + mock := &RequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterGenerics is an autogenerated mock type for the RequesterGenerics type +type RequesterGenerics[TAny any, TComparable comparable, TSigned constraints.Signed, TIntf test.GetInt, TExternalIntf io.Writer, TGenIntf test.GetGeneric[TSigned], TInlineType interface{ ~int | ~uint }, TInlineTypeGeneric interface { + ~int | test.GenericType[int, test.GetInt] + comparable +}] struct { + mock.Mock +} + +// GenericAnonymousStructs provides a mock function for the type RequesterGenerics +func (_mock *RequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]) GenericAnonymousStructs(val struct{ Type1 TExternalIntf }) struct { + Type2 test.GenericType[string, test.EmbeddedGet[int]] +} { + ret := _mock.Called(val) + + if len(ret) == 0 { + panic("no return value specified for GenericAnonymousStructs") + } + + var r0 struct { + Type2 test.GenericType[string, test.EmbeddedGet[int]] + } + if returnFunc, ok := ret.Get(0).(func(struct{ Type1 TExternalIntf }) struct { + Type2 test.GenericType[string, test.EmbeddedGet[int]] + }); ok { + r0 = returnFunc(val) + } else { + r0 = ret.Get(0).(struct { + Type2 test.GenericType[string, test.EmbeddedGet[int]] + }) + } + return r0 +} + +// GenericArguments provides a mock function for the type RequesterGenerics +func (_mock *RequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]) GenericArguments(v1 TAny, v2 TComparable) (TSigned, TIntf) { + ret := _mock.Called(v1, v2) + + if len(ret) == 0 { + panic("no return value specified for GenericArguments") + } + + var r0 TSigned + var r1 TIntf + if returnFunc, ok := ret.Get(0).(func(TAny, TComparable) (TSigned, TIntf)); ok { + return returnFunc(v1, v2) + } + if returnFunc, ok := ret.Get(0).(func(TAny, TComparable) TSigned); ok { + r0 = returnFunc(v1, v2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(TSigned) + } + } + if returnFunc, ok := ret.Get(1).(func(TAny, TComparable) TIntf); ok { + r1 = returnFunc(v1, v2) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(TIntf) + } + } + return r0, r1 +} + +// GenericStructs provides a mock function for the type RequesterGenerics +func (_mock *RequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]) GenericStructs(genericType test.GenericType[TAny, TIntf]) test.GenericType[TSigned, TIntf] { + ret := _mock.Called(genericType) + + if len(ret) == 0 { + panic("no return value specified for GenericStructs") + } + + var r0 test.GenericType[TSigned, TIntf] + if returnFunc, ok := ret.Get(0).(func(test.GenericType[TAny, TIntf]) test.GenericType[TSigned, TIntf]); ok { + r0 = returnFunc(genericType) + } else { + r0 = ret.Get(0).(test.GenericType[TSigned, TIntf]) + } + return r0 +} + +type RequesterGenerics_expecter[TAny any, TComparable comparable, TSigned constraints.Signed, TIntf test.GetInt, TExternalIntf io.Writer, TGenIntf test.GetGeneric[TSigned], TInlineType interface{ ~int | ~uint }, TInlineTypeGeneric interface { + ~int | test.GenericType[int, test.GetInt] + comparable +}] struct { + mock *mock.Mock +} + +func (_m *RequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]) EXPECT() *RequesterGenerics_expecter[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric] { + return &RequesterGenerics_expecter[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..c5a4170af --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterIface_mock.go @@ -0,0 +1,56 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "io" + + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterIface creates a new instance of RequesterIface. 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 NewRequesterIface(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterIface { + mock := &RequesterIface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterIface is an autogenerated mock type for the RequesterIface type +type RequesterIface struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterIface +func (_mock *RequesterIface) Get() io.Reader { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 io.Reader + if returnFunc, ok := ret.Get(0).(func() io.Reader); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(io.Reader) + } + } + return r0 +} + +type RequesterIface_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterIface) EXPECT() *RequesterIface_expecter { + return &RequesterIface_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterNS_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterNS_mock.go new file mode 100644 index 000000000..8a67b0dc4 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterNS_mock.go @@ -0,0 +1,63 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "net/http" + + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterNS creates a new instance of RequesterNS. 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 NewRequesterNS(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterNS { + mock := &RequesterNS{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterNS is an autogenerated mock type for the RequesterNS type +type RequesterNS struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterNS +func (_mock *RequesterNS) Get(path string) (http.Response, error) { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 http.Response + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (http.Response, error)); ok { + return returnFunc(path) + } + if returnFunc, ok := ret.Get(0).(func(string) http.Response); ok { + r0 = returnFunc(path) + } else { + r0 = ret.Get(0).(http.Response) + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(path) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type RequesterNS_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterNS) EXPECT() *RequesterNS_expecter { + return &RequesterNS_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterPtr_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterPtr_mock.go new file mode 100644 index 000000000..de538f4f4 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterPtr_mock.go @@ -0,0 +1,63 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterPtr creates a new instance of RequesterPtr. 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 NewRequesterPtr(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterPtr { + mock := &RequesterPtr{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterPtr is an autogenerated mock type for the RequesterPtr type +type RequesterPtr struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterPtr +func (_mock *RequesterPtr) Get(path string) (*string, error) { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (*string, error)); ok { + return returnFunc(path) + } + if returnFunc, ok := ret.Get(0).(func(string) *string); ok { + r0 = returnFunc(path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*string) + } + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(path) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type RequesterPtr_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterPtr) EXPECT() *RequesterPtr_expecter { + return &RequesterPtr_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterReturnElided_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterReturnElided_mock.go new file mode 100644 index 000000000..f083920a0 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterReturnElided_mock.go @@ -0,0 +1,99 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterReturnElided creates a new instance of RequesterReturnElided. 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 NewRequesterReturnElided(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterReturnElided { + mock := &RequesterReturnElided{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterReturnElided is an autogenerated mock type for the RequesterReturnElided type +type RequesterReturnElided struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterReturnElided +func (_mock *RequesterReturnElided) Get(path string) (int, int, int, error) { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 int + var r1 int + var r2 int + var r3 error + if returnFunc, ok := ret.Get(0).(func(string) (int, int, int, error)); ok { + return returnFunc(path) + } + if returnFunc, ok := ret.Get(0).(func(string) int); ok { + r0 = returnFunc(path) + } else { + r0 = ret.Get(0).(int) + } + if returnFunc, ok := ret.Get(1).(func(string) int); ok { + r1 = returnFunc(path) + } else { + r1 = ret.Get(1).(int) + } + if returnFunc, ok := ret.Get(2).(func(string) int); ok { + r2 = returnFunc(path) + } else { + r2 = ret.Get(2).(int) + } + if returnFunc, ok := ret.Get(3).(func(string) error); ok { + r3 = returnFunc(path) + } else { + r3 = ret.Error(3) + } + return r0, r1, r2, r3 +} + +// Put provides a mock function for the type RequesterReturnElided +func (_mock *RequesterReturnElided) Put(path string) (int, error) { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Put") + } + + var r0 int + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (int, error)); ok { + return returnFunc(path) + } + if returnFunc, ok := ret.Get(0).(func(string) int); ok { + r0 = returnFunc(path) + } else { + r0 = ret.Get(0).(int) + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(path) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type RequesterReturnElided_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterReturnElided) EXPECT() *RequesterReturnElided_expecter { + return &RequesterReturnElided_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterSlice_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterSlice_mock.go new file mode 100644 index 000000000..81c0089ca --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterSlice_mock.go @@ -0,0 +1,63 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterSlice creates a new instance of RequesterSlice. 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 NewRequesterSlice(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterSlice { + mock := &RequesterSlice{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterSlice is an autogenerated mock type for the RequesterSlice type +type RequesterSlice struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterSlice +func (_mock *RequesterSlice) Get(path string) ([]string, error) { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 []string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) ([]string, error)); ok { + return returnFunc(path) + } + if returnFunc, ok := ret.Get(0).(func(string) []string); ok { + r0 = returnFunc(path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(path) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type RequesterSlice_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterSlice) EXPECT() *RequesterSlice_expecter { + return &RequesterSlice_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterVariadicOneArgument_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterVariadicOneArgument_mock.go new file mode 100644 index 000000000..94d6e25b7 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterVariadicOneArgument_mock.go @@ -0,0 +1,129 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "io" + + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterVariadicOneArgument creates a new instance of RequesterVariadicOneArgument. 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 NewRequesterVariadicOneArgument(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterVariadicOneArgument { + mock := &RequesterVariadicOneArgument{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterVariadicOneArgument is an autogenerated mock type for the RequesterVariadic type +type RequesterVariadicOneArgument struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterVariadicOneArgument +func (_mock *RequesterVariadicOneArgument) Get(values ...string) bool { + var tmpRet mock.Arguments + if len(values) > 0 { + tmpRet = _mock.Called(values) + } else { + tmpRet = _mock.Called() + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(...string) bool); ok { + r0 = returnFunc(values...) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MultiWriteToFile provides a mock function for the type RequesterVariadicOneArgument +func (_mock *RequesterVariadicOneArgument) MultiWriteToFile(filename string, w ...io.Writer) string { + var tmpRet mock.Arguments + if len(w) > 0 { + tmpRet = _mock.Called(filename, w) + } else { + tmpRet = _mock.Called(filename) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for MultiWriteToFile") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func(string, ...io.Writer) string); ok { + r0 = returnFunc(filename, w...) + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +// OneInterface provides a mock function for the type RequesterVariadicOneArgument +func (_mock *RequesterVariadicOneArgument) OneInterface(a ...interface{}) bool { + var tmpRet mock.Arguments + if len(a) > 0 { + tmpRet = _mock.Called(a) + } else { + tmpRet = _mock.Called() + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for OneInterface") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(...interface{}) bool); ok { + r0 = returnFunc(a...) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// Sprintf provides a mock function for the type RequesterVariadicOneArgument +func (_mock *RequesterVariadicOneArgument) Sprintf(format string, a ...interface{}) string { + var tmpRet mock.Arguments + if len(a) > 0 { + tmpRet = _mock.Called(format, a) + } else { + tmpRet = _mock.Called(format) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Sprintf") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func(string, ...interface{}) string); ok { + r0 = returnFunc(format, a...) + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type RequesterVariadicOneArgument_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterVariadicOneArgument) EXPECT() *RequesterVariadicOneArgument_expecter { + return &RequesterVariadicOneArgument_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterVariadic_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterVariadic_mock.go new file mode 100644 index 000000000..d83e09407 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/RequesterVariadic_mock.go @@ -0,0 +1,125 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + "io" + + mock "github.com/stretchr/testify/mock" +) + +// NewRequesterVariadic creates a new instance of RequesterVariadic. 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 NewRequesterVariadic(t interface { + mock.TestingT + Cleanup(func()) +}) *RequesterVariadic { + mock := &RequesterVariadic{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// RequesterVariadic is an autogenerated mock type for the RequesterVariadic type +type RequesterVariadic struct { + mock.Mock +} + +// Get provides a mock function for the type RequesterVariadic +func (_mock *RequesterVariadic) Get(values ...string) bool { + // string + _va := make([]interface{}, len(values)) + for _i := range values { + _va[_i] = values[_i] + } + var _ca []interface{} + _ca = append(_ca, _va...) + ret := _mock.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(...string) bool); ok { + r0 = returnFunc(values...) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MultiWriteToFile provides a mock function for the type RequesterVariadic +func (_mock *RequesterVariadic) MultiWriteToFile(filename string, w ...io.Writer) string { + // io.Writer + _va := make([]interface{}, len(w)) + for _i := range w { + _va[_i] = w[_i] + } + var _ca []interface{} + _ca = append(_ca, filename) + _ca = append(_ca, _va...) + ret := _mock.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for MultiWriteToFile") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func(string, ...io.Writer) string); ok { + r0 = returnFunc(filename, w...) + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +// OneInterface provides a mock function for the type RequesterVariadic +func (_mock *RequesterVariadic) OneInterface(a ...interface{}) bool { + var _ca []interface{} + _ca = append(_ca, a...) + ret := _mock.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for OneInterface") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(...interface{}) bool); ok { + r0 = returnFunc(a...) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// Sprintf provides a mock function for the type RequesterVariadic +func (_mock *RequesterVariadic) Sprintf(format string, a ...interface{}) string { + var _ca []interface{} + _ca = append(_ca, format) + _ca = append(_ca, a...) + ret := _mock.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Sprintf") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func(string, ...interface{}) string); ok { + r0 = returnFunc(format, a...) + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type RequesterVariadic_expecter struct { + mock *mock.Mock +} + +func (_m *RequesterVariadic) EXPECT() *RequesterVariadic_expecter { + return &RequesterVariadic_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester_mock.go new file mode 100644 index 000000000..51a11a674 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Requester_mock.go @@ -0,0 +1,61 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewRequester creates a new instance of Requester. 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 NewRequester(t interface { + mock.TestingT + Cleanup(func()) +}) *Requester { + mock := &Requester{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Requester is an autogenerated mock type for the Requester type +type Requester struct { + mock.Mock +} + +// Get provides a mock function for the type Requester +func (_mock *Requester) Get(path string) (string, error) { + ret := _mock.Called(path) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (string, error)); ok { + return returnFunc(path) + } + if returnFunc, ok := ret.Get(0).(func(string) string); ok { + r0 = returnFunc(path) + } else { + r0 = ret.Get(0).(string) + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(path) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +type Requester_expecter struct { + mock *mock.Mock +} + +func (_m *Requester) EXPECT() *Requester_expecter { + return &Requester_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..606add64c --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Sibling_mock.go @@ -0,0 +1,41 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewSibling creates a new instance of Sibling. 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 NewSibling(t interface { + mock.TestingT + Cleanup(func()) +}) *Sibling { + mock := &Sibling{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Sibling is an autogenerated mock type for the Sibling type +type Sibling struct { + mock.Mock +} + +// DoSomething provides a mock function for the type Sibling +func (_mock *Sibling) DoSomething() { + _mock.Called() + return +} + +type Sibling_expecter struct { + mock *mock.Mock +} + +func (_m *Sibling) EXPECT() *Sibling_expecter { + return &Sibling_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/StructWithTag_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/StructWithTag_mock.go new file mode 100644 index 000000000..0866c833b --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/StructWithTag_mock.go @@ -0,0 +1,72 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewStructWithTag creates a new instance of StructWithTag. 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 NewStructWithTag(t interface { + mock.TestingT + Cleanup(func()) +}) *StructWithTag { + mock := &StructWithTag{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// StructWithTag is an autogenerated mock type for the StructWithTag type +type StructWithTag struct { + mock.Mock +} + +// MethodA provides a mock function for the type StructWithTag +func (_mock *StructWithTag) MethodA(v *struct { + FieldA int "json:\"field_a\"" + FieldB int "json:\"field_b\" xml:\"field_b\"" +}) *struct { + FieldC int "json:\"field_c\"" + FieldD int "json:\"field_d\" xml:\"field_d\"" +} { + ret := _mock.Called(v) + + if len(ret) == 0 { + panic("no return value specified for MethodA") + } + + var r0 *struct { + FieldC int "json:\"field_c\"" + FieldD int "json:\"field_d\" xml:\"field_d\"" + } + if returnFunc, ok := ret.Get(0).(func(*struct { + FieldA int "json:\"field_a\"" + FieldB int "json:\"field_b\" xml:\"field_b\"" + }) *struct { + FieldC int "json:\"field_c\"" + FieldD int "json:\"field_d\" xml:\"field_d\"" + }); ok { + r0 = returnFunc(v) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*struct { + FieldC int "json:\"field_c\"" + FieldD int "json:\"field_d\" xml:\"field_d\"" + }) + } + } + return r0 +} + +type StructWithTag_expecter struct { + mock *mock.Mock +} + +func (_m *StructWithTag) EXPECT() *StructWithTag_expecter { + return &StructWithTag_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..deb5ee5d5 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UnsafeInterface_mock.go @@ -0,0 +1,41 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewUnsafeInterface creates a new instance of UnsafeInterface. 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 NewUnsafeInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *UnsafeInterface { + mock := &UnsafeInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// UnsafeInterface is an autogenerated mock type for the UnsafeInterface type +type UnsafeInterface struct { + mock.Mock +} + +// Do provides a mock function for the type UnsafeInterface +func (_mock *UnsafeInterface) Do(ptr *Pointer) { + _mock.Called(ptr) + return +} + +type UnsafeInterface_expecter struct { + mock *mock.Mock +} + +func (_m *UnsafeInterface) EXPECT() *UnsafeInterface_expecter { + return &UnsafeInterface_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..919a5f4ab --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesAny_mock.go @@ -0,0 +1,54 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewUsesAny creates a new instance of UsesAny. 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 NewUsesAny(t interface { + mock.TestingT + Cleanup(func()) +}) *UsesAny { + mock := &UsesAny{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// UsesAny is an autogenerated mock type for the UsesAny type +type UsesAny struct { + mock.Mock +} + +// GetReader provides a mock function for the type UsesAny +func (_mock *UsesAny) GetReader() any { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for GetReader") + } + + var r0 any + if returnFunc, ok := ret.Get(0).(func() any); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(any) + } + } + return r0 +} + +type UsesAny_expecter struct { + mock *mock.Mock +} + +func (_m *UsesAny) EXPECT() *UsesAny_expecter { + return &UsesAny_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..f48292c28 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/UsesOtherPkgIface_mock.go @@ -0,0 +1,42 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + test "github.com/vektra/mockery/v2/pkg/fixtures" +) + +// NewUsesOtherPkgIface creates a new instance of UsesOtherPkgIface. 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 NewUsesOtherPkgIface(t interface { + mock.TestingT + Cleanup(func()) +}) *UsesOtherPkgIface { + mock := &UsesOtherPkgIface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// UsesOtherPkgIface is an autogenerated mock type for the UsesOtherPkgIface type +type UsesOtherPkgIface struct { + mock.Mock +} + +// DoSomethingElse provides a mock function for the type UsesOtherPkgIface +func (_mock *UsesOtherPkgIface) DoSomethingElse(obj test.Sibling) { + _mock.Called(obj) + return +} + +type UsesOtherPkgIface_expecter struct { + mock *mock.Mock +} + +func (_m *UsesOtherPkgIface) EXPECT() *UsesOtherPkgIface_expecter { + return &UsesOtherPkgIface_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..4c6b88238 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/VariadicNoReturnInterface_mock.go @@ -0,0 +1,45 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewVariadicNoReturnInterface creates a new instance of VariadicNoReturnInterface. 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 NewVariadicNoReturnInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *VariadicNoReturnInterface { + mock := &VariadicNoReturnInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// VariadicNoReturnInterface is an autogenerated mock type for the VariadicNoReturnInterface type +type VariadicNoReturnInterface struct { + mock.Mock +} + +// VariadicNoReturn provides a mock function for the type VariadicNoReturnInterface +func (_mock *VariadicNoReturnInterface) VariadicNoReturn(j int, is ...interface{}) { + if len(is) > 0 { + _mock.Called(j, is) + } else { + _mock.Called(j) + } + return +} + +type VariadicNoReturnInterface_expecter struct { + mock *mock.Mock +} + +func (_m *VariadicNoReturnInterface) EXPECT() *VariadicNoReturnInterface_expecter { + return &VariadicNoReturnInterface_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/VariadicReturnFunc_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/VariadicReturnFunc_mock.go new file mode 100644 index 000000000..9e0a310b3 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/VariadicReturnFunc_mock.go @@ -0,0 +1,54 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewVariadicReturnFunc creates a new instance of VariadicReturnFunc. 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 NewVariadicReturnFunc(t interface { + mock.TestingT + Cleanup(func()) +}) *VariadicReturnFunc { + mock := &VariadicReturnFunc{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// VariadicReturnFunc is an autogenerated mock type for the VariadicReturnFunc type +type VariadicReturnFunc struct { + mock.Mock +} + +// SampleMethod provides a mock function for the type VariadicReturnFunc +func (_mock *VariadicReturnFunc) SampleMethod(str string) func(str string, arr []int, a ...interface{}) { + ret := _mock.Called(str) + + if len(ret) == 0 { + panic("no return value specified for SampleMethod") + } + + var r0 func(str string, arr []int, a ...interface{}) + if returnFunc, ok := ret.Get(0).(func(string) func(str string, arr []int, a ...interface{})); ok { + r0 = returnFunc(str) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(func(str string, arr []int, a ...interface{})) + } + } + return r0 +} + +type VariadicReturnFunc_expecter struct { + mock *mock.Mock +} + +func (_m *VariadicReturnFunc) EXPECT() *VariadicReturnFunc_expecter { + return &VariadicReturnFunc_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Variadic_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Variadic_mock.go new file mode 100644 index 000000000..198902f2c --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/Variadic_mock.go @@ -0,0 +1,53 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + test "github.com/vektra/mockery/v2/pkg/fixtures" +) + +// NewVariadic creates a new instance of Variadic. 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 NewVariadic(t interface { + mock.TestingT + Cleanup(func()) +}) *Variadic { + mock := &Variadic{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Variadic is an autogenerated mock type for the Variadic type +type Variadic struct { + mock.Mock +} + +// VariadicFunction provides a mock function for the type Variadic +func (_mock *Variadic) VariadicFunction(str string, vFunc test.VariadicFunction) error { + ret := _mock.Called(str, vFunc) + + if len(ret) == 0 { + panic("no return value specified for VariadicFunction") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(string, test.VariadicFunction) error); ok { + r0 = returnFunc(str, vFunc) + } else { + r0 = ret.Error(0) + } + return r0 +} + +type Variadic_expecter struct { + mock *mock.Mock +} + +func (_m *Variadic) EXPECT() *Variadic_expecter { + return &Variadic_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..0e6f7ec53 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/buildtag/comment/IfaceWithCustomBuildTagInComment_mock.go @@ -0,0 +1,66 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +//go:build custom3 && (!windows || !darwin || !freebsd) + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewIfaceWithCustomBuildTagInComment creates a new instance of IfaceWithCustomBuildTagInComment. 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 NewIfaceWithCustomBuildTagInComment(t interface { + mock.TestingT + Cleanup(func()) +}) *IfaceWithCustomBuildTagInComment { + mock := &IfaceWithCustomBuildTagInComment{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// IfaceWithCustomBuildTagInComment is an autogenerated mock type for the IfaceWithCustomBuildTagInComment type +type IfaceWithCustomBuildTagInComment struct { + mock.Mock +} + +// Custom2 provides a mock function for the type IfaceWithCustomBuildTagInComment +func (_mock *IfaceWithCustomBuildTagInComment) Custom2() { + _mock.Called() + return +} + +// Sprintf provides a mock function for the type IfaceWithCustomBuildTagInComment +func (_mock *IfaceWithCustomBuildTagInComment) Sprintf(format string, a ...interface{}) string { + var tmpRet mock.Arguments + if len(a) > 0 { + tmpRet = _mock.Called(format, a) + } else { + tmpRet = _mock.Called(format) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Sprintf") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func(string, ...interface{}) string); ok { + r0 = returnFunc(format, a...) + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type IfaceWithCustomBuildTagInComment_expecter struct { + mock *mock.Mock +} + +func (_m *IfaceWithCustomBuildTagInComment) EXPECT() *IfaceWithCustomBuildTagInComment_expecter { + return &IfaceWithCustomBuildTagInComment_expecter{mock: &_m.Mock} +} diff --git a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/mockery_mock.go b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/mockery_mock.go deleted file mode 100644 index 24f12bd74..000000000 --- a/mocks/github.com/vektra/mockery/v2/pkg/fixtures/mockery_mock.go +++ /dev/null @@ -1,422 +0,0 @@ -// TEST MOCKERY BOILERPLATE -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery - -//go:build test - -package mocks - -import ( - "io" - - mock "github.com/stretchr/testify/mock" - test "github.com/vektra/mockery/v2/pkg/fixtures" - "github.com/vektra/mockery/v2/pkg/fixtures/constraints" -) - -// NewExpecterAndRolledVariadic creates a new instance of ExpecterAndRolledVariadic. 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 NewExpecterAndRolledVariadic(t interface { - mock.TestingT - Cleanup(func()) -}) *ExpecterAndRolledVariadic { - mock := &ExpecterAndRolledVariadic{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - -// ExpecterAndRolledVariadic is an autogenerated mock type for the Expecter type -type ExpecterAndRolledVariadic struct { - mock.Mock -} - -// ManyArgsReturns provides a mock function for the type ExpecterAndRolledVariadic -func (_mock *ExpecterAndRolledVariadic) ManyArgsReturns(str string, i int) ([]string, error) { - ret := _mock.Called(str, i) - - if len(ret) == 0 { - panic("no return value specified for ManyArgsReturns") - } - - var r0 []string - var r1 error - if returnFunc, ok := ret.Get(0).(func(string, int) ([]string, error)); ok { - return returnFunc(str, i) - } - if returnFunc, ok := ret.Get(0).(func(string, int) []string); ok { - r0 = returnFunc(str, i) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - if returnFunc, ok := ret.Get(1).(func(string, int) error); ok { - r1 = returnFunc(str, i) - } else { - r1 = ret.Error(1) - } - return r0, r1 -} - -// NoArg provides a mock function for the type ExpecterAndRolledVariadic -func (_mock *ExpecterAndRolledVariadic) NoArg() string { - ret := _mock.Called() - - if len(ret) == 0 { - panic("no return value specified for NoArg") - } - - var r0 string - if returnFunc, ok := ret.Get(0).(func() string); ok { - r0 = returnFunc() - } else { - r0 = ret.Get(0).(string) - } - return r0 -} - -// NoReturn provides a mock function for the type ExpecterAndRolledVariadic -func (_mock *ExpecterAndRolledVariadic) NoReturn(str string) { - _mock.Called(str) - return -} - -// Variadic provides a mock function for the type ExpecterAndRolledVariadic -func (_mock *ExpecterAndRolledVariadic) Variadic(ints ...int) error { - var tmpRet mock.Arguments - if len(ints) > 0 { - tmpRet = _mock.Called(ints) - } else { - tmpRet = _mock.Called() - } - ret := tmpRet - - if len(ret) == 0 { - panic("no return value specified for Variadic") - } - - var r0 error - if returnFunc, ok := ret.Get(0).(func(...int) error); ok { - r0 = returnFunc(ints...) - } else { - r0 = ret.Error(0) - } - return r0 -} - -// VariadicMany provides a mock function for the type ExpecterAndRolledVariadic -func (_mock *ExpecterAndRolledVariadic) VariadicMany(i int, a string, intfs ...interface{}) error { - var tmpRet mock.Arguments - if len(intfs) > 0 { - tmpRet = _mock.Called(i, a, intfs) - } else { - tmpRet = _mock.Called(i, a) - } - ret := tmpRet - - if len(ret) == 0 { - panic("no return value specified for VariadicMany") - } - - var r0 error - if returnFunc, ok := ret.Get(0).(func(int, string, ...interface{}) error); ok { - r0 = returnFunc(i, a, intfs...) - } else { - r0 = ret.Error(0) - } - return r0 -} - -type ExpecterAndRolledVariadic_expecter struct { - mock *mock.Mock -} - -func (_m *ExpecterAndRolledVariadic) EXPECT() *ExpecterAndRolledVariadic_expecter { - return &ExpecterAndRolledVariadic_expecter{mock: &_m.Mock} -} - -// NewExpecter creates a new instance of Expecter. 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 NewExpecter(t interface { - mock.TestingT - Cleanup(func()) -}) *Expecter { - mock := &Expecter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - -// Expecter is an autogenerated mock type for the Expecter type -type Expecter struct { - mock.Mock -} - -// ManyArgsReturns provides a mock function for the type Expecter -func (_mock *Expecter) ManyArgsReturns(str string, i int) ([]string, error) { - ret := _mock.Called(str, i) - - if len(ret) == 0 { - panic("no return value specified for ManyArgsReturns") - } - - var r0 []string - var r1 error - if returnFunc, ok := ret.Get(0).(func(string, int) ([]string, error)); ok { - return returnFunc(str, i) - } - if returnFunc, ok := ret.Get(0).(func(string, int) []string); ok { - r0 = returnFunc(str, i) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - if returnFunc, ok := ret.Get(1).(func(string, int) error); ok { - r1 = returnFunc(str, i) - } else { - r1 = ret.Error(1) - } - return r0, r1 -} - -// NoArg provides a mock function for the type Expecter -func (_mock *Expecter) NoArg() string { - ret := _mock.Called() - - if len(ret) == 0 { - panic("no return value specified for NoArg") - } - - var r0 string - if returnFunc, ok := ret.Get(0).(func() string); ok { - r0 = returnFunc() - } else { - r0 = ret.Get(0).(string) - } - return r0 -} - -// NoReturn provides a mock function for the type Expecter -func (_mock *Expecter) NoReturn(str string) { - _mock.Called(str) - return -} - -// Variadic provides a mock function for the type Expecter -func (_mock *Expecter) Variadic(ints ...int) error { - // int - _va := make([]interface{}, len(ints)) - for _i := range ints { - _va[_i] = ints[_i] - } - var _ca []interface{} - _ca = append(_ca, _va...) - ret := _mock.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for Variadic") - } - - var r0 error - if returnFunc, ok := ret.Get(0).(func(...int) error); ok { - r0 = returnFunc(ints...) - } else { - r0 = ret.Error(0) - } - return r0 -} - -// VariadicMany provides a mock function for the type Expecter -func (_mock *Expecter) VariadicMany(i int, a string, intfs ...interface{}) error { - var _ca []interface{} - _ca = append(_ca, i, a) - _ca = append(_ca, intfs...) - ret := _mock.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for VariadicMany") - } - - var r0 error - if returnFunc, ok := ret.Get(0).(func(int, string, ...interface{}) error); ok { - r0 = returnFunc(i, a, intfs...) - } else { - r0 = ret.Error(0) - } - return r0 -} - -type Expecter_expecter struct { - mock *mock.Mock -} - -func (_m *Expecter) EXPECT() *Expecter_expecter { - return &Expecter_expecter{mock: &_m.Mock} -} - -// NewMockRequesterGenerics creates a new instance of MockRequesterGenerics. 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 NewMockRequesterGenerics[TAny any, TComparable comparable, TSigned constraints.Signed, TIntf test.GetInt, TExternalIntf io.Writer, TGenIntf test.GetGeneric[TSigned], TInlineType interface{ ~int | ~uint }, TInlineTypeGeneric interface { - ~int | test.GenericType[int, test.GetInt] - comparable -}](t interface { - mock.TestingT - Cleanup(func()) -}) *MockRequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric] { - mock := &MockRequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - -// MockRequesterGenerics is an autogenerated mock type for the RequesterGenerics type -type MockRequesterGenerics[TAny any, TComparable comparable, TSigned constraints.Signed, TIntf test.GetInt, TExternalIntf io.Writer, TGenIntf test.GetGeneric[TSigned], TInlineType interface{ ~int | ~uint }, TInlineTypeGeneric interface { - ~int | test.GenericType[int, test.GetInt] - comparable -}] struct { - mock.Mock -} - -// GenericAnonymousStructs provides a mock function for the type MockRequesterGenerics -func (_mock *MockRequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]) GenericAnonymousStructs(val struct{ Type1 TExternalIntf }) struct { - Type2 test.GenericType[string, test.EmbeddedGet[int]] -} { - ret := _mock.Called(val) - - if len(ret) == 0 { - panic("no return value specified for GenericAnonymousStructs") - } - - var r0 struct { - Type2 test.GenericType[string, test.EmbeddedGet[int]] - } - if returnFunc, ok := ret.Get(0).(func(struct{ Type1 TExternalIntf }) struct { - Type2 test.GenericType[string, test.EmbeddedGet[int]] - }); ok { - r0 = returnFunc(val) - } else { - r0 = ret.Get(0).(struct { - Type2 test.GenericType[string, test.EmbeddedGet[int]] - }) - } - return r0 -} - -// GenericArguments provides a mock function for the type MockRequesterGenerics -func (_mock *MockRequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]) GenericArguments(v1 TAny, v2 TComparable) (TSigned, TIntf) { - ret := _mock.Called(v1, v2) - - if len(ret) == 0 { - panic("no return value specified for GenericArguments") - } - - var r0 TSigned - var r1 TIntf - if returnFunc, ok := ret.Get(0).(func(TAny, TComparable) (TSigned, TIntf)); ok { - return returnFunc(v1, v2) - } - if returnFunc, ok := ret.Get(0).(func(TAny, TComparable) TSigned); ok { - r0 = returnFunc(v1, v2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(TSigned) - } - } - if returnFunc, ok := ret.Get(1).(func(TAny, TComparable) TIntf); ok { - r1 = returnFunc(v1, v2) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(TIntf) - } - } - return r0, r1 -} - -// GenericStructs provides a mock function for the type MockRequesterGenerics -func (_mock *MockRequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]) GenericStructs(genericType test.GenericType[TAny, TIntf]) test.GenericType[TSigned, TIntf] { - ret := _mock.Called(genericType) - - if len(ret) == 0 { - panic("no return value specified for GenericStructs") - } - - var r0 test.GenericType[TSigned, TIntf] - if returnFunc, ok := ret.Get(0).(func(test.GenericType[TAny, TIntf]) test.GenericType[TSigned, TIntf]); ok { - r0 = returnFunc(genericType) - } else { - r0 = ret.Get(0).(test.GenericType[TSigned, TIntf]) - } - return r0 -} - -type MockRequesterGenerics_expecter[TAny any, TComparable comparable, TSigned constraints.Signed, TIntf test.GetInt, TExternalIntf io.Writer, TGenIntf test.GetGeneric[TSigned], TInlineType interface{ ~int | ~uint }, TInlineTypeGeneric interface { - ~int | test.GenericType[int, test.GetInt] - comparable -}] struct { - mock *mock.Mock -} - -func (_m *MockRequesterGenerics[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]) EXPECT() *MockRequesterGenerics_expecter[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric] { - return &MockRequesterGenerics_expecter[TAny, TComparable, TSigned, TIntf, TExternalIntf, TGenIntf, TInlineType, TInlineTypeGeneric]{mock: &_m.Mock} -} - -// NewMockA creates a new instance of MockA. 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 NewMockA(t interface { - mock.TestingT - Cleanup(func()) -}) *MockA { - mock := &MockA{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - -// MockA is an autogenerated mock type for the A type -type MockA struct { - mock.Mock -} - -// Call provides a mock function for the type MockA -func (_mock *MockA) Call() (test.B, error) { - ret := _mock.Called() - - if len(ret) == 0 { - panic("no return value specified for Call") - } - - var r0 test.B - var r1 error - if returnFunc, ok := ret.Get(0).(func() (test.B, error)); ok { - return returnFunc() - } - if returnFunc, ok := ret.Get(0).(func() test.B); ok { - r0 = returnFunc() - } else { - r0 = ret.Get(0).(test.B) - } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() - } else { - r1 = ret.Error(1) - } - return r0, r1 -} - -type MockA_expecter struct { - mock *mock.Mock -} - -func (_m *MockA) EXPECT() *MockA_expecter { - return &MockA_expecter{mock: &_m.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 new file mode 100644 index 000000000..06ce4ffc0 --- /dev/null +++ b/mocks/github.com/vektra/mockery/v2/pkg/fixtures/requesterUnexported_mock.go @@ -0,0 +1,41 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// 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 +} + +// requesterUnexported is an autogenerated mock type for the requesterUnexported type +type requesterUnexported struct { + mock.Mock +} + +// Get provides a mock function for the type requesterUnexported +func (_mock *requesterUnexported) Get() { + _mock.Called() + return +} + +type requesterUnexported_expecter struct { + mock *mock.Mock +} + +func (_m *requesterUnexported) EXPECT() *requesterUnexported_expecter { + return &requesterUnexported_expecter{mock: &_m.Mock} +} diff --git a/pkg/config.go b/pkg/config.go index ec1ce7c78..8214f3116 100644 --- a/pkg/config.go +++ b/pkg/config.go @@ -16,7 +16,6 @@ import ( "github.com/chigopher/pathlib" "github.com/huandu/xstrings" - "github.com/iancoleman/strcase" "github.com/jinzhu/copier" "github.com/mitchellh/mapstructure" "github.com/rs/zerolog" @@ -50,7 +49,6 @@ type Config struct { FileName string `mapstructure:"filename"` Formatter string `mapstructure:"formatter"` IncludeRegex string `mapstructure:"include-regex"` - Issue845Fix bool `mapstructure:"issue-845-fix"` LogLevel string `mapstructure:"log-level"` MockBuildTags string `mapstructure:"mock-build-tags"` MockName string `mapstructure:"mockname"` @@ -80,11 +78,11 @@ func NewConfigFromViper(v *viper.Viper) (*Config, error) { Config: v.ConfigFileUsed(), } - v.SetDefault("dir", "mocks/{{.PackagePath}}") + v.SetDefault("dir", "mocks/{{.SrcPackagePath}}") v.SetDefault("filename", "mock_{{.InterfaceName}}.go") v.SetDefault("formatter", "goimports") v.SetDefault("mockname", "Mock{{.InterfaceName}}") - v.SetDefault("pkgname", "{{.PackageName}}") + v.SetDefault("pkgname", "{{.SrcPackageName}}") v.SetDefault("dry-run", false) v.SetDefault("log-level", "info") @@ -822,66 +820,65 @@ var templateFuncMap = template.FuncMap{ // ParseTemplates parses various templated strings // in the config struct into their fully defined values. This mutates -// the config object passed. It requires an *Interface object in order -// to satisfy template variables that need information about the original -// interface being mocked. -func (c *Config) ParseTemplates(ctx context.Context, iface *Interface) error { +// the config object passed. An *Interface object can be supplied to satisfy +// template variables that need information about the original +// interface being mocked. If this argument is nil, interface-specific template +// variables will be set to the empty string. The srcPkg is also needed to +// satisfy template variables regarding the source package. +func (c *Config) ParseTemplates(ctx context.Context, iface *Interface, srcPkg *packages.Package) error { log := zerolog.Ctx(ctx) - mock := "mock" - if ast.IsExported(iface.Name) { - mock = "Mock" + mock := "" + if iface != nil { + mock = "mock" + if ast.IsExported(iface.Name) { + mock = "Mock" + } } - workingDir, err := os.Getwd() - if err != nil { - return fmt.Errorf("get working directory: %w", err) - } - var interfaceDirRelative string - interfaceDir := pathlib.NewPath(iface.FileName).Parent() - interfaceDirRelativePath, err := interfaceDir.RelativeToStr(workingDir) - if errors.Is(err, pathlib.ErrRelativeTo) { - log.Debug(). - Stringer("interface-dir", interfaceDir). - Str("working-dir", workingDir). - Msg("can't make interfaceDir relative to working dir. Setting InterfaceDirRelative to package path.") - - interfaceDirRelative = iface.Pkg.Types.Path() - } else { + var ( + interfaceDir string + interfaceDirRelative string + interfaceFile string + interfaceName string + ) + if iface != nil { + interfaceFile = iface.FileName + interfaceName = iface.Name + + workingDir, err := os.Getwd() + if err != nil { + return fmt.Errorf("get working directory: %w", err) + } + interfaceDirPath := pathlib.NewPath(iface.FileName).Parent() + interfaceDir = interfaceDirPath.String() + interfaceDirRelativePath, err := interfaceDirPath.RelativeToStr(workingDir) + if err != nil { + return stackerr.NewStackErr(err) + } interfaceDirRelative = interfaceDirRelativePath.String() } - // data is the struct sent to the template parser data := struct { - ConfigDir string - InterfaceDir string - InterfaceDirRelative string - InterfaceFile string - InterfaceName string - InterfaceNameCamel string - InterfaceNameLowerCamel string - InterfaceNameSnake string - InterfaceNameLower string - Mock string - MockName string - PackageName string - PackagePath string + ConfigDir string + InterfaceDir string + InterfaceDirRelative string + InterfaceFile string + InterfaceName string + Mock string + MockName string + SrcPackageName string + SrcPackagePath string }{ ConfigDir: filepath.Dir(c.Config), - InterfaceDir: filepath.Dir(iface.FileName), + InterfaceDir: interfaceDir, InterfaceDirRelative: interfaceDirRelative, - InterfaceFile: iface.FileName, - InterfaceName: iface.Name, - // Deprecated: All custom case variables of InterfaceName will be removed in the next major version - // Use the template functions instead - InterfaceNameCamel: strcase.ToCamel(iface.Name), - InterfaceNameLowerCamel: strcase.ToLowerCamel(iface.Name), - InterfaceNameSnake: strcase.ToSnake(iface.Name), - InterfaceNameLower: strings.ToLower(iface.Name), - Mock: mock, - MockName: c.MockName, - PackageName: iface.Pkg.Types.Name(), - PackagePath: iface.Pkg.Types.Path(), + InterfaceFile: interfaceFile, + InterfaceName: interfaceName, + Mock: mock, + MockName: c.MockName, + SrcPackageName: srcPkg.Types.Name(), + SrcPackagePath: srcPkg.Types.Path(), } // These are the config options that we allow // to be parsed by the templater. The keys are 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 000000000..be9e270f2 --- /dev/null +++ b/pkg/fixtures/empty_return/mock_EmptyReturn_test.go @@ -0,0 +1,47 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package test + +import ( + mock "github.com/stretchr/testify/mock" +) + +// 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 +} + +// EmptyReturnMock is an autogenerated mock type for the EmptyReturn type +type EmptyReturnMock struct { + mock.Mock +} + +// NoArgs provides a mock function for the type EmptyReturnMock +func (_mock *EmptyReturnMock) NoArgs() { + _mock.Called() + return +} + +// WithArgs provides a mock function for the type EmptyReturnMock +func (_mock *EmptyReturnMock) WithArgs(a int, b string) { + _mock.Called(a, b) + return +} + +type EmptyReturnMock_expecter struct { + mock *mock.Mock +} + +func (_m *EmptyReturnMock) EXPECT() *EmptyReturnMock_expecter { + return &EmptyReturnMock_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/example_project/mock_root_test.go b/pkg/fixtures/example_project/mock_root_test.go new file mode 100644 index 000000000..071ceb4e8 --- /dev/null +++ b/pkg/fixtures/example_project/mock_root_test.go @@ -0,0 +1,70 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package example_project_test + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/vektra/mockery/v2/pkg/fixtures/example_project/foo" +) + +// NewMockRoot creates a new instance of MockRoot. 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 NewMockRoot(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRoot { + mock := &MockRoot{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockRoot is an autogenerated mock type for the Root type +type MockRoot struct { + mock.Mock +} + +// ReturnsFoo provides a mock function for the type MockRoot +func (_mock *MockRoot) ReturnsFoo() (foo.Foo, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for ReturnsFoo") + } + + var r0 foo.Foo + var r1 error + if returnFunc, ok := ret.Get(0).(func() (foo.Foo, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() foo.Foo); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(foo.Foo) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// TakesBaz provides a mock function for the type MockRoot +func (_mock *MockRoot) TakesBaz(baz *foo.Baz) { + _mock.Called(baz) + return +} + +type MockRoot_expecter struct { + mock *mock.Mock +} + +func (_m *MockRoot) EXPECT() *MockRoot_expecter { + return &MockRoot_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/example_project/mock_stringer_test.go b/pkg/fixtures/example_project/mock_stringer_test.go new file mode 100644 index 000000000..a013bf647 --- /dev/null +++ b/pkg/fixtures/example_project/mock_stringer_test.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package example_project_test + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockStringer creates a new instance of MockStringer. 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 NewMockStringer(t interface { + mock.TestingT + Cleanup(func()) +}) *MockStringer { + mock := &MockStringer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockStringer is an autogenerated mock type for the Stringer type +type MockStringer struct { + mock.Mock +} + +// String provides a mock function for the type MockStringer +func (_mock *MockStringer) String() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for String") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type MockStringer_expecter struct { + mock *mock.Mock +} + +func (_m *MockStringer) EXPECT() *MockStringer_expecter { + return &MockStringer_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/iface_new_type/mock_interface1_test.go b/pkg/fixtures/iface_new_type/mock_interface1_test.go new file mode 100644 index 000000000..8c881a8f3 --- /dev/null +++ b/pkg/fixtures/iface_new_type/mock_interface1_test.go @@ -0,0 +1,41 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package iface_new_type_test + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockInterface1 creates a new instance of MockInterface1. 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 NewMockInterface1(t interface { + mock.TestingT + Cleanup(func()) +}) *MockInterface1 { + mock := &MockInterface1{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockInterface1 is an autogenerated mock type for the Interface1 type +type MockInterface1 struct { + mock.Mock +} + +// Method1 provides a mock function for the type MockInterface1 +func (_mock *MockInterface1) Method1() { + _mock.Called() + return +} + +type MockInterface1_expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface1) EXPECT() *MockInterface1_expecter { + return &MockInterface1_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..f1437205a --- /dev/null +++ b/pkg/fixtures/iface_typed_param/mock_getter_iface_typed_param_test.go @@ -0,0 +1,56 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package iface_typed_param_test + +import ( + "io" + + mock "github.com/stretchr/testify/mock" +) + +// NewMockGetterIfaceTypedParam creates a new instance of MockGetterIfaceTypedParam. 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 NewMockGetterIfaceTypedParam[T io.Reader](t interface { + mock.TestingT + Cleanup(func()) +}) *MockGetterIfaceTypedParam[T] { + mock := &MockGetterIfaceTypedParam[T]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockGetterIfaceTypedParam is an autogenerated mock type for the GetterIfaceTypedParam type +type MockGetterIfaceTypedParam[T io.Reader] struct { + mock.Mock +} + +// Get provides a mock function for the type MockGetterIfaceTypedParam +func (_mock *MockGetterIfaceTypedParam[T]) Get() T { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 T + if returnFunc, ok := ret.Get(0).(func() T); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(T) + } + } + return r0 +} + +type MockGetterIfaceTypedParam_expecter[T io.Reader] struct { + mock *mock.Mock +} + +func (_m *MockGetterIfaceTypedParam[T]) EXPECT() *MockGetterIfaceTypedParam_expecter[T] { + return &MockGetterIfaceTypedParam_expecter[T]{mock: &_m.Mock} +} diff --git a/pkg/fixtures/index_list_expr/mock_generic_multiple_types_test.go b/pkg/fixtures/index_list_expr/mock_generic_multiple_types_test.go new file mode 100644 index 000000000..ecf8359f4 --- /dev/null +++ b/pkg/fixtures/index_list_expr/mock_generic_multiple_types_test.go @@ -0,0 +1,54 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package index_list_expr_test + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockGenericMultipleTypes creates a new instance of MockGenericMultipleTypes. 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 NewMockGenericMultipleTypes[T1 any, T2 any, T3 any](t interface { + mock.TestingT + Cleanup(func()) +}) *MockGenericMultipleTypes[T1, T2, T3] { + mock := &MockGenericMultipleTypes[T1, T2, T3]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockGenericMultipleTypes is an autogenerated mock type for the GenericMultipleTypes type +type MockGenericMultipleTypes[T1 any, T2 any, T3 any] struct { + mock.Mock +} + +// Func provides a mock function for the type MockGenericMultipleTypes +func (_mock *MockGenericMultipleTypes[T1, T2, T3]) Func(arg1 *T1, arg2 T2) T3 { + ret := _mock.Called(arg1, arg2) + + if len(ret) == 0 { + panic("no return value specified for Func") + } + + var r0 T3 + if returnFunc, ok := ret.Get(0).(func(*T1, T2) T3); ok { + r0 = returnFunc(arg1, arg2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(T3) + } + } + return r0 +} + +type MockGenericMultipleTypes_expecter[T1 any, T2 any, T3 any] struct { + mock *mock.Mock +} + +func (_m *MockGenericMultipleTypes[T1, T2, T3]) EXPECT() *MockGenericMultipleTypes_expecter[T1, T2, T3] { + return &MockGenericMultipleTypes_expecter[T1, T2, T3]{mock: &_m.Mock} +} diff --git a/pkg/fixtures/index_list_expr/mock_index_list_expr_test.go b/pkg/fixtures/index_list_expr/mock_index_list_expr_test.go new file mode 100644 index 000000000..8b2ca3174 --- /dev/null +++ b/pkg/fixtures/index_list_expr/mock_index_list_expr_test.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package index_list_expr_test + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockIndexListExpr creates a new instance of MockIndexListExpr. 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 NewMockIndexListExpr(t interface { + mock.TestingT + Cleanup(func()) +}) *MockIndexListExpr { + mock := &MockIndexListExpr{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockIndexListExpr is an autogenerated mock type for the IndexListExpr type +type MockIndexListExpr struct { + mock.Mock +} + +// Func provides a mock function for the type MockIndexListExpr +func (_mock *MockIndexListExpr) Func(arg1 *int, arg2 string) bool { + ret := _mock.Called(arg1, arg2) + + if len(ret) == 0 { + panic("no return value specified for Func") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(*int, string) bool); ok { + r0 = returnFunc(arg1, arg2) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +type MockIndexListExpr_expecter struct { + mock *mock.Mock +} + +func (_m *MockIndexListExpr) EXPECT() *MockIndexListExpr_expecter { + return &MockIndexListExpr_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/issue845/mock_WithFix_test.go b/pkg/fixtures/issue845/mock_WithFix_test.go new file mode 100644 index 000000000..435f9ee06 --- /dev/null +++ b/pkg/fixtures/issue845/mock_WithFix_test.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package issue845_test + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewWithFix creates a new instance of WithFix. 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 NewWithFix(t interface { + mock.TestingT + Cleanup(func()) +}) *WithFix { + mock := &WithFix{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// WithFix is an autogenerated mock type for the Interface type +type WithFix struct { + mock.Mock +} + +// Foo provides a mock function for the type WithFix +func (_mock *WithFix) Foo() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Foo") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type WithFix_expecter struct { + mock *mock.Mock +} + +func (_m *WithFix) EXPECT() *WithFix_expecter { + return &WithFix_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceA_test.go b/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceA_test.go new file mode 100644 index 000000000..5f5a2d721 --- /dev/null +++ b/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceA_test.go @@ -0,0 +1,92 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package same_name_arg_and_type + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewinterfaceAMock creates a new instance of interfaceAMock. 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 NewinterfaceAMock(t interface { + mock.TestingT + Cleanup(func()) +}) *interfaceAMock { + mock := &interfaceAMock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// interfaceAMock is an autogenerated mock type for the interfaceA type +type interfaceAMock struct { + mock.Mock +} + +// DoB provides a mock function for the type interfaceAMock +func (_mock *interfaceAMock) DoB(interfaceB same_name_arg_and_type.interfaceB) same_name_arg_and_type.interfaceB { + ret := _mock.Called(interfaceB) + + if len(ret) == 0 { + panic("no return value specified for DoB") + } + + var r0 same_name_arg_and_type.interfaceB + if returnFunc, ok := ret.Get(0).(func(same_name_arg_and_type.interfaceB) same_name_arg_and_type.interfaceB); ok { + r0 = returnFunc(interfaceB) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(same_name_arg_and_type.interfaceB) + } + } + return r0 +} + +// DoB0 provides a mock function for the type interfaceAMock +func (_mock *interfaceAMock) DoB0(interfaceB same_name_arg_and_type.interfaceB0) same_name_arg_and_type.interfaceB0 { + ret := _mock.Called(interfaceB) + + if len(ret) == 0 { + panic("no return value specified for DoB0") + } + + var r0 same_name_arg_and_type.interfaceB0 + if returnFunc, ok := ret.Get(0).(func(same_name_arg_and_type.interfaceB0) same_name_arg_and_type.interfaceB0); ok { + r0 = returnFunc(interfaceB) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(same_name_arg_and_type.interfaceB0) + } + } + return r0 +} + +// DoB0v2 provides a mock function for the type interfaceAMock +func (_mock *interfaceAMock) DoB0v2(interfaceB0 same_name_arg_and_type.interfaceB0) same_name_arg_and_type.interfaceB0 { + ret := _mock.Called(interfaceB0) + + if len(ret) == 0 { + panic("no return value specified for DoB0v2") + } + + var r0 same_name_arg_and_type.interfaceB0 + if returnFunc, ok := ret.Get(0).(func(same_name_arg_and_type.interfaceB0) same_name_arg_and_type.interfaceB0); ok { + r0 = returnFunc(interfaceB0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(same_name_arg_and_type.interfaceB0) + } + } + return r0 +} + +type interfaceAMock_expecter struct { + mock *mock.Mock +} + +func (_m *interfaceAMock) EXPECT() *interfaceAMock_expecter { + return &interfaceAMock_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceB0_test.go b/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceB0_test.go new file mode 100644 index 000000000..246b119b8 --- /dev/null +++ b/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceB0_test.go @@ -0,0 +1,54 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package same_name_arg_and_type + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewinterfaceB0Mock creates a new instance of interfaceB0Mock. 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 NewinterfaceB0Mock(t interface { + mock.TestingT + Cleanup(func()) +}) *interfaceB0Mock { + mock := &interfaceB0Mock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// interfaceB0Mock is an autogenerated mock type for the interfaceB0 type +type interfaceB0Mock struct { + mock.Mock +} + +// DoB0 provides a mock function for the type interfaceB0Mock +func (_mock *interfaceB0Mock) DoB0(interfaceB0 same_name_arg_and_type.interfaceB0) same_name_arg_and_type.interfaceB0 { + ret := _mock.Called(interfaceB0) + + if len(ret) == 0 { + panic("no return value specified for DoB0") + } + + var r0 same_name_arg_and_type.interfaceB0 + if returnFunc, ok := ret.Get(0).(func(same_name_arg_and_type.interfaceB0) same_name_arg_and_type.interfaceB0); ok { + r0 = returnFunc(interfaceB0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(same_name_arg_and_type.interfaceB0) + } + } + return r0 +} + +type interfaceB0Mock_expecter struct { + mock *mock.Mock +} + +func (_m *interfaceB0Mock) EXPECT() *interfaceB0Mock_expecter { + return &interfaceB0Mock_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..6e2675648 --- /dev/null +++ b/pkg/fixtures/method_args/same_name_arg_and_type/mock_interfaceB_test.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package same_name_arg_and_type + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewinterfaceBMock creates a new instance of interfaceBMock. 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 NewinterfaceBMock(t interface { + mock.TestingT + Cleanup(func()) +}) *interfaceBMock { + mock := &interfaceBMock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// interfaceBMock is an autogenerated mock type for the interfaceB type +type interfaceBMock struct { + mock.Mock +} + +// GetData provides a mock function for the type interfaceBMock +func (_mock *interfaceBMock) GetData() int { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for GetData") + } + + var r0 int + if returnFunc, ok := ret.Get(0).(func() int); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(int) + } + return r0 +} + +type interfaceBMock_expecter struct { + mock *mock.Mock +} + +func (_m *interfaceBMock) EXPECT() *interfaceBMock_expecter { + return &interfaceBMock_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/recursive_generation/Foo_mock.go b/pkg/fixtures/recursive_generation/Foo_mock.go new file mode 100644 index 000000000..067413de5 --- /dev/null +++ b/pkg/fixtures/recursive_generation/Foo_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package recursive_generation + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockFoo creates a new instance of MockFoo. 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 NewMockFoo(t interface { + mock.TestingT + Cleanup(func()) +}) *MockFoo { + mock := &MockFoo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockFoo is an autogenerated mock type for the Foo type +type MockFoo struct { + mock.Mock +} + +// Get provides a mock function for the type MockFoo +func (_mock *MockFoo) Get() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type MockFoo_expecter struct { + mock *mock.Mock +} + +func (_m *MockFoo) EXPECT() *MockFoo_expecter { + return &MockFoo_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/recursive_generation/subpkg1/Foo_mock.go b/pkg/fixtures/recursive_generation/subpkg1/Foo_mock.go new file mode 100644 index 000000000..f1d1bf40c --- /dev/null +++ b/pkg/fixtures/recursive_generation/subpkg1/Foo_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package subpkg1 + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockFoo creates a new instance of MockFoo. 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 NewMockFoo(t interface { + mock.TestingT + Cleanup(func()) +}) *MockFoo { + mock := &MockFoo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockFoo is an autogenerated mock type for the Foo type +type MockFoo struct { + mock.Mock +} + +// Get provides a mock function for the type MockFoo +func (_mock *MockFoo) Get() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type MockFoo_expecter struct { + mock *mock.Mock +} + +func (_m *MockFoo) EXPECT() *MockFoo_expecter { + return &MockFoo_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/recursive_generation/subpkg2/Foo_mock.go b/pkg/fixtures/recursive_generation/subpkg2/Foo_mock.go new file mode 100644 index 000000000..42f87463a --- /dev/null +++ b/pkg/fixtures/recursive_generation/subpkg2/Foo_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package subpkg2 + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockFoo creates a new instance of MockFoo. 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 NewMockFoo(t interface { + mock.TestingT + Cleanup(func()) +}) *MockFoo { + mock := &MockFoo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockFoo is an autogenerated mock type for the Foo type +type MockFoo struct { + mock.Mock +} + +// Get provides a mock function for the type MockFoo +func (_mock *MockFoo) Get() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type MockFoo_expecter struct { + mock *mock.Mock +} + +func (_m *MockFoo) EXPECT() *MockFoo_expecter { + return &MockFoo_expecter{mock: &_m.Mock} +} 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 new file mode 100644 index 000000000..452a2e7d8 --- /dev/null +++ b/pkg/fixtures/recursive_generation/subpkg_with_only_autogenerated_files/Foo_mock.go @@ -0,0 +1,52 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package subpkg_with_only_autogenerated_files + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockFoo creates a new instance of MockFoo. 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 NewMockFoo(t interface { + mock.TestingT + Cleanup(func()) +}) *MockFoo { + mock := &MockFoo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockFoo is an autogenerated mock type for the Foo type +type MockFoo struct { + mock.Mock +} + +// Get provides a mock function for the type MockFoo +func (_mock *MockFoo) Get() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +type MockFoo_expecter struct { + mock *mock.Mock +} + +func (_m *MockFoo) EXPECT() *MockFoo_expecter { + return &MockFoo_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/type_alias/mock_Interface1_test.go b/pkg/fixtures/type_alias/mock_Interface1_test.go new file mode 100644 index 000000000..589d70d2b --- /dev/null +++ b/pkg/fixtures/type_alias/mock_Interface1_test.go @@ -0,0 +1,53 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package type_alias_test + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/vektra/mockery/v2/pkg/fixtures/type_alias" +) + +// NewInterface1 creates a new instance of Interface1. 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 NewInterface1(t interface { + mock.TestingT + Cleanup(func()) +}) *Interface1 { + mock := &Interface1{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Interface1 is an autogenerated mock type for the Interface1 type +type Interface1 struct { + mock.Mock +} + +// Foo provides a mock function for the type Interface1 +func (_mock *Interface1) Foo() type_alias.Type { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Foo") + } + + var r0 type_alias.Type + if returnFunc, ok := ret.Get(0).(func() type_alias.Type); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(type_alias.Type) + } + return r0 +} + +type Interface1_expecter struct { + mock *mock.Mock +} + +func (_m *Interface1) EXPECT() *Interface1_expecter { + return &Interface1_expecter{mock: &_m.Mock} +} diff --git a/pkg/fixtures/type_alias/mock_Interface2_test.go b/pkg/fixtures/type_alias/mock_Interface2_test.go new file mode 100644 index 000000000..2ed9552e9 --- /dev/null +++ b/pkg/fixtures/type_alias/mock_Interface2_test.go @@ -0,0 +1,43 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery + +package type_alias_test + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/vektra/mockery/v2/pkg/fixtures/type_alias" + "github.com/vektra/mockery/v2/pkg/fixtures/type_alias/subpkg" +) + +// NewInterface2 creates a new instance of Interface2. 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 NewInterface2(t interface { + mock.TestingT + Cleanup(func()) +}) *Interface2 { + mock := &Interface2{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// Interface2 is an autogenerated mock type for the Interface2 type +type Interface2 struct { + mock.Mock +} + +// F provides a mock function for the type Interface2 +func (_mock *Interface2) F(v1 type_alias.Type, v2 type_alias.S, s subpkg.S) { + _mock.Called(v1, v2, s) + return +} + +type Interface2_expecter struct { + mock *mock.Mock +} + +func (_m *Interface2) EXPECT() *Interface2_expecter { + return &Interface2_expecter{mock: &_m.Mock} +}