fix(mockery): add include-auto-generated config for InitAPI mocks
Add include-auto-generated: true to .mockery.yml package config so mockery can discover and generate mocks for the generated InitAPI interface in internal/ports/out/init_gen.go. Also add testify/mock dependency to go.mod for the generated mocks.
- commit
- a0e3d349c1cff677be2e09602c60502adb77fcdd
- author
- brice · · 2026-04-09 05:38 UTC
- parent
- f771147
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +138 -1
M .mockery.yml +3 -0
| @@ -8,5 +8,8 @@ structname: "Mock{{.InterfaceName}}" | |||
| 8 | 8 | ||
| 9 | 9 | packages: | |
| 10 | 10 | github.com/bnema/purego-pipewire/internal/ports/out: | |
| 11 | + | config: | |
| 12 | + | all: false | |
| 13 | + | include-auto-generated: true | |
| 11 | 14 | interfaces: | |
| 12 | 15 | InitAPI: | |
| @@ -8,5 +8,8 @@ structname: "Mock{{.InterfaceName}}" | |||||
| 8 | 8 | ||||
| 9 | packages: | 9 | packages: | ||
| 10 | github.com/bnema/purego-pipewire/internal/ports/out: | 10 | github.com/bnema/purego-pipewire/internal/ports/out: | ||
| 11 | + | config: | |||
| 12 | + | all: false | |||
| 13 | + | include-auto-generated: true | |||
| 11 | interfaces: | 14 | interfaces: | ||
| 12 | InitAPI: | 15 | InitAPI: | ||
M go.mod +9 -1
| @@ -2,4 +2,12 @@ module github.com/bnema/purego-pipewire | |||
| 2 | 2 | ||
| 3 | 3 | go 1.23 | |
| 4 | 4 | ||
| 5 | - | require github.com/ebitengine/purego v0.10.0 // indirect | |
| 5 | + | require github.com/ebitengine/purego v0.10.0 | |
| 6 | + | ||
| 7 | + | require ( | |
| 8 | + | github.com/davecgh/go-spew v1.1.1 // indirect | |
| 9 | + | github.com/pmezard/go-difflib v1.0.0 // indirect | |
| 10 | + | github.com/stretchr/objx v0.5.2 // indirect | |
| 11 | + | github.com/stretchr/testify v1.11.1 // indirect | |
| 12 | + | gopkg.in/yaml.v3 v3.0.1 // indirect | |
| 13 | + | ) | |
| @@ -2,4 +2,12 @@ module github.com/bnema/purego-pipewire | |||||
| 2 | 2 | ||||
| 3 | go 1.23 | 3 | go 1.23 | ||
| 4 | 4 | ||||
| 5 | - | require github.com/ebitengine/purego v0.10.0 // indirect | 5 | + | require github.com/ebitengine/purego v0.10.0 |
| 6 | + | ||||
| 7 | + | require ( | |||
| 8 | + | github.com/davecgh/go-spew v1.1.1 // indirect | |||
| 9 | + | github.com/pmezard/go-difflib v1.0.0 // indirect | |||
| 10 | + | github.com/stretchr/objx v0.5.2 // indirect | |||
| 11 | + | github.com/stretchr/testify v1.11.1 // indirect | |||
| 12 | + | gopkg.in/yaml.v3 v3.0.1 // indirect | |||
| 13 | + | ) | |||
M go.sum +11 -0 generated file: collapsed
A internal/ports/out/mocks/mock_InitAPI.go +115 -0
| @@ -0,0 +1,115 @@ | |||
| 1 | + | // Code generated by mockery; DO NOT EDIT. | |
| 2 | + | // github.com/vektra/mockery | |
| 3 | + | // template: testify | |
| 4 | + | ||
| 5 | + | package mocks | |
| 6 | + | ||
| 7 | + | import ( | |
| 8 | + | mock "github.com/stretchr/testify/mock" | |
| 9 | + | ) | |
| 10 | + | ||
| 11 | + | // NewMockInitAPI creates a new instance of MockInitAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 12 | + | // The first argument is typically a *testing.T value. | |
| 13 | + | func NewMockInitAPI(t interface { | |
| 14 | + | mock.TestingT | |
| 15 | + | Cleanup(func()) | |
| 16 | + | }) *MockInitAPI { | |
| 17 | + | mock := &MockInitAPI{} | |
| 18 | + | mock.Mock.Test(t) | |
| 19 | + | ||
| 20 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 21 | + | ||
| 22 | + | return mock | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // MockInitAPI is an autogenerated mock type for the InitAPI type | |
| 26 | + | type MockInitAPI struct { | |
| 27 | + | mock.Mock | |
| 28 | + | } | |
| 29 | + | ||
| 30 | + | type MockInitAPI_Expecter struct { | |
| 31 | + | mock *mock.Mock | |
| 32 | + | } | |
| 33 | + | ||
| 34 | + | func (_m *MockInitAPI) EXPECT() *MockInitAPI_Expecter { | |
| 35 | + | return &MockInitAPI_Expecter{mock: &_m.Mock} | |
| 36 | + | } | |
| 37 | + | ||
| 38 | + | // PWDeinit provides a mock function for the type MockInitAPI | |
| 39 | + | func (_mock *MockInitAPI) PWDeinit() { | |
| 40 | + | _mock.Called() | |
| 41 | + | return | |
| 42 | + | } | |
| 43 | + | ||
| 44 | + | // MockInitAPI_PWDeinit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWDeinit' | |
| 45 | + | type MockInitAPI_PWDeinit_Call struct { | |
| 46 | + | *mock.Call | |
| 47 | + | } | |
| 48 | + | ||
| 49 | + | // PWDeinit is a helper method to define mock.On call | |
| 50 | + | func (_e *MockInitAPI_Expecter) PWDeinit() *MockInitAPI_PWDeinit_Call { | |
| 51 | + | return &MockInitAPI_PWDeinit_Call{Call: _e.mock.On("PWDeinit")} | |
| 52 | + | } | |
| 53 | + | ||
| 54 | + | func (_c *MockInitAPI_PWDeinit_Call) Run(run func()) *MockInitAPI_PWDeinit_Call { | |
| 55 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 56 | + | run() | |
| 57 | + | }) | |
| 58 | + | return _c | |
| 59 | + | } | |
| 60 | + | ||
| 61 | + | func (_c *MockInitAPI_PWDeinit_Call) Return() *MockInitAPI_PWDeinit_Call { | |
| 62 | + | _c.Call.Return() | |
| 63 | + | return _c | |
| 64 | + | } | |
| 65 | + | ||
| 66 | + | func (_c *MockInitAPI_PWDeinit_Call) RunAndReturn(run func()) *MockInitAPI_PWDeinit_Call { | |
| 67 | + | _c.Run(run) | |
| 68 | + | return _c | |
| 69 | + | } | |
| 70 | + | ||
| 71 | + | // PWInit provides a mock function for the type MockInitAPI | |
| 72 | + | func (_mock *MockInitAPI) PWInit(argc *int32, argv ***byte) { | |
| 73 | + | _mock.Called(argc, argv) | |
| 74 | + | return | |
| 75 | + | } | |
| 76 | + | ||
| 77 | + | // MockInitAPI_PWInit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWInit' | |
| 78 | + | type MockInitAPI_PWInit_Call struct { | |
| 79 | + | *mock.Call | |
| 80 | + | } | |
| 81 | + | ||
| 82 | + | // PWInit is a helper method to define mock.On call | |
| 83 | + | // - argc *int32 | |
| 84 | + | // - argv ***byte | |
| 85 | + | func (_e *MockInitAPI_Expecter) PWInit(argc interface{}, argv interface{}) *MockInitAPI_PWInit_Call { | |
| 86 | + | return &MockInitAPI_PWInit_Call{Call: _e.mock.On("PWInit", argc, argv)} | |
| 87 | + | } | |
| 88 | + | ||
| 89 | + | func (_c *MockInitAPI_PWInit_Call) Run(run func(argc *int32, argv ***byte)) *MockInitAPI_PWInit_Call { | |
| 90 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 91 | + | var arg0 *int32 | |
| 92 | + | if args[0] != nil { | |
| 93 | + | arg0 = args[0].(*int32) | |
| 94 | + | } | |
| 95 | + | var arg1 ***byte | |
| 96 | + | if args[1] != nil { | |
| 97 | + | arg1 = args[1].(***byte) | |
| 98 | + | } | |
| 99 | + | run( | |
| 100 | + | arg0, | |
| 101 | + | arg1, | |
| 102 | + | ) | |
| 103 | + | }) | |
| 104 | + | return _c | |
| 105 | + | } | |
| 106 | + | ||
| 107 | + | func (_c *MockInitAPI_PWInit_Call) Return() *MockInitAPI_PWInit_Call { | |
| 108 | + | _c.Call.Return() | |
| 109 | + | return _c | |
| 110 | + | } | |
| 111 | + | ||
| 112 | + | func (_c *MockInitAPI_PWInit_Call) RunAndReturn(run func(argc *int32, argv ***byte)) *MockInitAPI_PWInit_Call { | |
| 113 | + | _c.Run(run) | |
| 114 | + | return _c | |
| 115 | + | } | |
| @@ -0,0 +1,115 @@ | |||||
| 1 | + | // Code generated by mockery; DO NOT EDIT. | |||
| 2 | + | // github.com/vektra/mockery | |||
| 3 | + | // template: testify | |||
| 4 | + | ||||
| 5 | + | package mocks | |||
| 6 | + | ||||
| 7 | + | import ( | |||
| 8 | + | mock "github.com/stretchr/testify/mock" | |||
| 9 | + | ) | |||
| 10 | + | ||||
| 11 | + | // NewMockInitAPI creates a new instance of MockInitAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |||
| 12 | + | // The first argument is typically a *testing.T value. | |||
| 13 | + | func NewMockInitAPI(t interface { | |||
| 14 | + | mock.TestingT | |||
| 15 | + | Cleanup(func()) | |||
| 16 | + | }) *MockInitAPI { | |||
| 17 | + | mock := &MockInitAPI{} | |||
| 18 | + | mock.Mock.Test(t) | |||
| 19 | + | ||||
| 20 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 21 | + | ||||
| 22 | + | return mock | |||
| 23 | + | } | |||
| 24 | + | ||||
| 25 | + | // MockInitAPI is an autogenerated mock type for the InitAPI type | |||
| 26 | + | type MockInitAPI struct { | |||
| 27 | + | mock.Mock | |||
| 28 | + | } | |||
| 29 | + | ||||
| 30 | + | type MockInitAPI_Expecter struct { | |||
| 31 | + | mock *mock.Mock | |||
| 32 | + | } | |||
| 33 | + | ||||
| 34 | + | func (_m *MockInitAPI) EXPECT() *MockInitAPI_Expecter { | |||
| 35 | + | return &MockInitAPI_Expecter{mock: &_m.Mock} | |||
| 36 | + | } | |||
| 37 | + | ||||
| 38 | + | // PWDeinit provides a mock function for the type MockInitAPI | |||
| 39 | + | func (_mock *MockInitAPI) PWDeinit() { | |||
| 40 | + | _mock.Called() | |||
| 41 | + | return | |||
| 42 | + | } | |||
| 43 | + | ||||
| 44 | + | // MockInitAPI_PWDeinit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWDeinit' | |||
| 45 | + | type MockInitAPI_PWDeinit_Call struct { | |||
| 46 | + | *mock.Call | |||
| 47 | + | } | |||
| 48 | + | ||||
| 49 | + | // PWDeinit is a helper method to define mock.On call | |||
| 50 | + | func (_e *MockInitAPI_Expecter) PWDeinit() *MockInitAPI_PWDeinit_Call { | |||
| 51 | + | return &MockInitAPI_PWDeinit_Call{Call: _e.mock.On("PWDeinit")} | |||
| 52 | + | } | |||
| 53 | + | ||||
| 54 | + | func (_c *MockInitAPI_PWDeinit_Call) Run(run func()) *MockInitAPI_PWDeinit_Call { | |||
| 55 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 56 | + | run() | |||
| 57 | + | }) | |||
| 58 | + | return _c | |||
| 59 | + | } | |||
| 60 | + | ||||
| 61 | + | func (_c *MockInitAPI_PWDeinit_Call) Return() *MockInitAPI_PWDeinit_Call { | |||
| 62 | + | _c.Call.Return() | |||
| 63 | + | return _c | |||
| 64 | + | } | |||
| 65 | + | ||||
| 66 | + | func (_c *MockInitAPI_PWDeinit_Call) RunAndReturn(run func()) *MockInitAPI_PWDeinit_Call { | |||
| 67 | + | _c.Run(run) | |||
| 68 | + | return _c | |||
| 69 | + | } | |||
| 70 | + | ||||
| 71 | + | // PWInit provides a mock function for the type MockInitAPI | |||
| 72 | + | func (_mock *MockInitAPI) PWInit(argc *int32, argv ***byte) { | |||
| 73 | + | _mock.Called(argc, argv) | |||
| 74 | + | return | |||
| 75 | + | } | |||
| 76 | + | ||||
| 77 | + | // MockInitAPI_PWInit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWInit' | |||
| 78 | + | type MockInitAPI_PWInit_Call struct { | |||
| 79 | + | *mock.Call | |||
| 80 | + | } | |||
| 81 | + | ||||
| 82 | + | // PWInit is a helper method to define mock.On call | |||
| 83 | + | // - argc *int32 | |||
| 84 | + | // - argv ***byte | |||
| 85 | + | func (_e *MockInitAPI_Expecter) PWInit(argc interface{}, argv interface{}) *MockInitAPI_PWInit_Call { | |||
| 86 | + | return &MockInitAPI_PWInit_Call{Call: _e.mock.On("PWInit", argc, argv)} | |||
| 87 | + | } | |||
| 88 | + | ||||
| 89 | + | func (_c *MockInitAPI_PWInit_Call) Run(run func(argc *int32, argv ***byte)) *MockInitAPI_PWInit_Call { | |||
| 90 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 91 | + | var arg0 *int32 | |||
| 92 | + | if args[0] != nil { | |||
| 93 | + | arg0 = args[0].(*int32) | |||
| 94 | + | } | |||
| 95 | + | var arg1 ***byte | |||
| 96 | + | if args[1] != nil { | |||
| 97 | + | arg1 = args[1].(***byte) | |||
| 98 | + | } | |||
| 99 | + | run( | |||
| 100 | + | arg0, | |||
| 101 | + | arg1, | |||
| 102 | + | ) | |||
| 103 | + | }) | |||
| 104 | + | return _c | |||
| 105 | + | } | |||
| 106 | + | ||||
| 107 | + | func (_c *MockInitAPI_PWInit_Call) Return() *MockInitAPI_PWInit_Call { | |||
| 108 | + | _c.Call.Return() | |||
| 109 | + | return _c | |||
| 110 | + | } | |||
| 111 | + | ||||
| 112 | + | func (_c *MockInitAPI_PWInit_Call) RunAndReturn(run func(argc *int32, argv ***byte)) *MockInitAPI_PWInit_Call { | |||
| 113 | + | _c.Run(run) | |||
| 114 | + | return _c | |||
| 115 | + | } | |||