test: add mockery coverage for PipeWire lifecycle
- commit
- fc64dc022d772892151de4ec04135d20d9937ebe
- author
- brice · · 2026-04-09 07:29 UTC
- parent
- f567416
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +303 -0
M .mockery.yml +4 -0
| @@ -15,3 +15,7 @@ packages: | |||
| 15 | 15 | CAPI: | |
| 16 | 16 | InitAPI: | |
| 17 | 17 | LoopAPI: | |
| 18 | + | github.com/bnema/purego-pipewire/pipewire: | |
| 19 | + | interfaces: | |
| 20 | + | Runtime: | |
| 21 | + | MainLoop: | |
| @@ -15,3 +15,7 @@ packages: | |||||
| 15 | CAPI: | 15 | CAPI: | ||
| 16 | InitAPI: | 16 | InitAPI: | ||
| 17 | LoopAPI: | 17 | LoopAPI: | ||
| 18 | + | github.com/bnema/purego-pipewire/pipewire: | |||
| 19 | + | interfaces: | |||
| 20 | + | Runtime: | |||
| 21 | + | MainLoop: | |||
A integration/init_test.go +17 -0
| @@ -0,0 +1,17 @@ | |||
| 1 | + | //go:build integration | |
| 2 | + | ||
| 3 | + | package integration | |
| 4 | + | ||
| 5 | + | import ( | |
| 6 | + | "testing" | |
| 7 | + | ||
| 8 | + | "github.com/bnema/purego-pipewire/pipewire" | |
| 9 | + | ) | |
| 10 | + | ||
| 11 | + | func TestInitSmoke(t *testing.T) { | |
| 12 | + | r, err := pipewire.Init() | |
| 13 | + | if err != nil { | |
| 14 | + | t.Fatalf("Init returned error: %v", err) | |
| 15 | + | } | |
| 16 | + | r.Deinit() | |
| 17 | + | } | |
| @@ -0,0 +1,17 @@ | |||||
| 1 | + | //go:build integration | |||
| 2 | + | ||||
| 3 | + | package integration | |||
| 4 | + | ||||
| 5 | + | import ( | |||
| 6 | + | "testing" | |||
| 7 | + | ||||
| 8 | + | "github.com/bnema/purego-pipewire/pipewire" | |||
| 9 | + | ) | |||
| 10 | + | ||||
| 11 | + | func TestInitSmoke(t *testing.T) { | |||
| 12 | + | r, err := pipewire.Init() | |||
| 13 | + | if err != nil { | |||
| 14 | + | t.Fatalf("Init returned error: %v", err) | |||
| 15 | + | } | |||
| 16 | + | r.Deinit() | |||
| 17 | + | } | |||
A pipewire/mocks/mock_MainLoop.go +113 -0
| @@ -0,0 +1,113 @@ | |||
| 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 | + | // NewMockMainLoop creates a new instance of MockMainLoop. 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 NewMockMainLoop(t interface { | |
| 14 | + | mock.TestingT | |
| 15 | + | Cleanup(func()) | |
| 16 | + | }) *MockMainLoop { | |
| 17 | + | mock := &MockMainLoop{} | |
| 18 | + | mock.Mock.Test(t) | |
| 19 | + | ||
| 20 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 21 | + | ||
| 22 | + | return mock | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | // MockMainLoop is an autogenerated mock type for the MainLoop type | |
| 26 | + | type MockMainLoop struct { | |
| 27 | + | mock.Mock | |
| 28 | + | } | |
| 29 | + | ||
| 30 | + | type MockMainLoop_Expecter struct { | |
| 31 | + | mock *mock.Mock | |
| 32 | + | } | |
| 33 | + | ||
| 34 | + | func (_m *MockMainLoop) EXPECT() *MockMainLoop_Expecter { | |
| 35 | + | return &MockMainLoop_Expecter{mock: &_m.Mock} | |
| 36 | + | } | |
| 37 | + | ||
| 38 | + | // Destroy provides a mock function for the type MockMainLoop | |
| 39 | + | func (_mock *MockMainLoop) Destroy() { | |
| 40 | + | _mock.Called() | |
| 41 | + | return | |
| 42 | + | } | |
| 43 | + | ||
| 44 | + | // MockMainLoop_Destroy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Destroy' | |
| 45 | + | type MockMainLoop_Destroy_Call struct { | |
| 46 | + | *mock.Call | |
| 47 | + | } | |
| 48 | + | ||
| 49 | + | // Destroy is a helper method to define mock.On call | |
| 50 | + | func (_e *MockMainLoop_Expecter) Destroy() *MockMainLoop_Destroy_Call { | |
| 51 | + | return &MockMainLoop_Destroy_Call{Call: _e.mock.On("Destroy")} | |
| 52 | + | } | |
| 53 | + | ||
| 54 | + | func (_c *MockMainLoop_Destroy_Call) Run(run func()) *MockMainLoop_Destroy_Call { | |
| 55 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 56 | + | run() | |
| 57 | + | }) | |
| 58 | + | return _c | |
| 59 | + | } | |
| 60 | + | ||
| 61 | + | func (_c *MockMainLoop_Destroy_Call) Return() *MockMainLoop_Destroy_Call { | |
| 62 | + | _c.Call.Return() | |
| 63 | + | return _c | |
| 64 | + | } | |
| 65 | + | ||
| 66 | + | func (_c *MockMainLoop_Destroy_Call) RunAndReturn(run func()) *MockMainLoop_Destroy_Call { | |
| 67 | + | _c.Run(run) | |
| 68 | + | return _c | |
| 69 | + | } | |
| 70 | + | ||
| 71 | + | // Run provides a mock function for the type MockMainLoop | |
| 72 | + | func (_mock *MockMainLoop) Run() int32 { | |
| 73 | + | ret := _mock.Called() | |
| 74 | + | ||
| 75 | + | if len(ret) == 0 { | |
| 76 | + | panic("no return value specified for Run") | |
| 77 | + | } | |
| 78 | + | ||
| 79 | + | var r0 int32 | |
| 80 | + | if returnFunc, ok := ret.Get(0).(func() int32); ok { | |
| 81 | + | r0 = returnFunc() | |
| 82 | + | } else { | |
| 83 | + | r0 = ret.Get(0).(int32) | |
| 84 | + | } | |
| 85 | + | return r0 | |
| 86 | + | } | |
| 87 | + | ||
| 88 | + | // MockMainLoop_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run' | |
| 89 | + | type MockMainLoop_Run_Call struct { | |
| 90 | + | *mock.Call | |
| 91 | + | } | |
| 92 | + | ||
| 93 | + | // Run is a helper method to define mock.On call | |
| 94 | + | func (_e *MockMainLoop_Expecter) Run() *MockMainLoop_Run_Call { | |
| 95 | + | return &MockMainLoop_Run_Call{Call: _e.mock.On("Run")} | |
| 96 | + | } | |
| 97 | + | ||
| 98 | + | func (_c *MockMainLoop_Run_Call) Run(run func()) *MockMainLoop_Run_Call { | |
| 99 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 100 | + | run() | |
| 101 | + | }) | |
| 102 | + | return _c | |
| 103 | + | } | |
| 104 | + | ||
| 105 | + | func (_c *MockMainLoop_Run_Call) Return(n int32) *MockMainLoop_Run_Call { | |
| 106 | + | _c.Call.Return(n) | |
| 107 | + | return _c | |
| 108 | + | } | |
| 109 | + | ||
| 110 | + | func (_c *MockMainLoop_Run_Call) RunAndReturn(run func() int32) *MockMainLoop_Run_Call { | |
| 111 | + | _c.Call.Return(run) | |
| 112 | + | return _c | |
| 113 | + | } | |
| @@ -0,0 +1,113 @@ | |||||
| 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 | + | // NewMockMainLoop creates a new instance of MockMainLoop. 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 NewMockMainLoop(t interface { | |||
| 14 | + | mock.TestingT | |||
| 15 | + | Cleanup(func()) | |||
| 16 | + | }) *MockMainLoop { | |||
| 17 | + | mock := &MockMainLoop{} | |||
| 18 | + | mock.Mock.Test(t) | |||
| 19 | + | ||||
| 20 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 21 | + | ||||
| 22 | + | return mock | |||
| 23 | + | } | |||
| 24 | + | ||||
| 25 | + | // MockMainLoop is an autogenerated mock type for the MainLoop type | |||
| 26 | + | type MockMainLoop struct { | |||
| 27 | + | mock.Mock | |||
| 28 | + | } | |||
| 29 | + | ||||
| 30 | + | type MockMainLoop_Expecter struct { | |||
| 31 | + | mock *mock.Mock | |||
| 32 | + | } | |||
| 33 | + | ||||
| 34 | + | func (_m *MockMainLoop) EXPECT() *MockMainLoop_Expecter { | |||
| 35 | + | return &MockMainLoop_Expecter{mock: &_m.Mock} | |||
| 36 | + | } | |||
| 37 | + | ||||
| 38 | + | // Destroy provides a mock function for the type MockMainLoop | |||
| 39 | + | func (_mock *MockMainLoop) Destroy() { | |||
| 40 | + | _mock.Called() | |||
| 41 | + | return | |||
| 42 | + | } | |||
| 43 | + | ||||
| 44 | + | // MockMainLoop_Destroy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Destroy' | |||
| 45 | + | type MockMainLoop_Destroy_Call struct { | |||
| 46 | + | *mock.Call | |||
| 47 | + | } | |||
| 48 | + | ||||
| 49 | + | // Destroy is a helper method to define mock.On call | |||
| 50 | + | func (_e *MockMainLoop_Expecter) Destroy() *MockMainLoop_Destroy_Call { | |||
| 51 | + | return &MockMainLoop_Destroy_Call{Call: _e.mock.On("Destroy")} | |||
| 52 | + | } | |||
| 53 | + | ||||
| 54 | + | func (_c *MockMainLoop_Destroy_Call) Run(run func()) *MockMainLoop_Destroy_Call { | |||
| 55 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 56 | + | run() | |||
| 57 | + | }) | |||
| 58 | + | return _c | |||
| 59 | + | } | |||
| 60 | + | ||||
| 61 | + | func (_c *MockMainLoop_Destroy_Call) Return() *MockMainLoop_Destroy_Call { | |||
| 62 | + | _c.Call.Return() | |||
| 63 | + | return _c | |||
| 64 | + | } | |||
| 65 | + | ||||
| 66 | + | func (_c *MockMainLoop_Destroy_Call) RunAndReturn(run func()) *MockMainLoop_Destroy_Call { | |||
| 67 | + | _c.Run(run) | |||
| 68 | + | return _c | |||
| 69 | + | } | |||
| 70 | + | ||||
| 71 | + | // Run provides a mock function for the type MockMainLoop | |||
| 72 | + | func (_mock *MockMainLoop) Run() int32 { | |||
| 73 | + | ret := _mock.Called() | |||
| 74 | + | ||||
| 75 | + | if len(ret) == 0 { | |||
| 76 | + | panic("no return value specified for Run") | |||
| 77 | + | } | |||
| 78 | + | ||||
| 79 | + | var r0 int32 | |||
| 80 | + | if returnFunc, ok := ret.Get(0).(func() int32); ok { | |||
| 81 | + | r0 = returnFunc() | |||
| 82 | + | } else { | |||
| 83 | + | r0 = ret.Get(0).(int32) | |||
| 84 | + | } | |||
| 85 | + | return r0 | |||
| 86 | + | } | |||
| 87 | + | ||||
| 88 | + | // MockMainLoop_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run' | |||
| 89 | + | type MockMainLoop_Run_Call struct { | |||
| 90 | + | *mock.Call | |||
| 91 | + | } | |||
| 92 | + | ||||
| 93 | + | // Run is a helper method to define mock.On call | |||
| 94 | + | func (_e *MockMainLoop_Expecter) Run() *MockMainLoop_Run_Call { | |||
| 95 | + | return &MockMainLoop_Run_Call{Call: _e.mock.On("Run")} | |||
| 96 | + | } | |||
| 97 | + | ||||
| 98 | + | func (_c *MockMainLoop_Run_Call) Run(run func()) *MockMainLoop_Run_Call { | |||
| 99 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 100 | + | run() | |||
| 101 | + | }) | |||
| 102 | + | return _c | |||
| 103 | + | } | |||
| 104 | + | ||||
| 105 | + | func (_c *MockMainLoop_Run_Call) Return(n int32) *MockMainLoop_Run_Call { | |||
| 106 | + | _c.Call.Return(n) | |||
| 107 | + | return _c | |||
| 108 | + | } | |||
| 109 | + | ||||
| 110 | + | func (_c *MockMainLoop_Run_Call) RunAndReturn(run func() int32) *MockMainLoop_Run_Call { | |||
| 111 | + | _c.Call.Return(run) | |||
| 112 | + | return _c | |||
| 113 | + | } | |||
A pipewire/mocks/mock_Runtime.go +169 -0
| @@ -0,0 +1,169 @@ | |||
| 1 | + | // Code generated by mockery; DO NOT EDIT. | |
| 2 | + | // github.com/vektra/mockery | |
| 3 | + | // template: testify | |
| 4 | + | ||
| 5 | + | package mocks | |
| 6 | + | ||
| 7 | + | import ( | |
| 8 | + | "github.com/bnema/purego-pipewire/pipewire" | |
| 9 | + | mock "github.com/stretchr/testify/mock" | |
| 10 | + | ) | |
| 11 | + | ||
| 12 | + | // NewMockRuntime creates a new instance of MockRuntime. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 13 | + | // The first argument is typically a *testing.T value. | |
| 14 | + | func NewMockRuntime(t interface { | |
| 15 | + | mock.TestingT | |
| 16 | + | Cleanup(func()) | |
| 17 | + | }) *MockRuntime { | |
| 18 | + | mock := &MockRuntime{} | |
| 19 | + | mock.Mock.Test(t) | |
| 20 | + | ||
| 21 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 22 | + | ||
| 23 | + | return mock | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | // MockRuntime is an autogenerated mock type for the Runtime type | |
| 27 | + | type MockRuntime struct { | |
| 28 | + | mock.Mock | |
| 29 | + | } | |
| 30 | + | ||
| 31 | + | type MockRuntime_Expecter struct { | |
| 32 | + | mock *mock.Mock | |
| 33 | + | } | |
| 34 | + | ||
| 35 | + | func (_m *MockRuntime) EXPECT() *MockRuntime_Expecter { | |
| 36 | + | return &MockRuntime_Expecter{mock: &_m.Mock} | |
| 37 | + | } | |
| 38 | + | ||
| 39 | + | // Deinit provides a mock function for the type MockRuntime | |
| 40 | + | func (_mock *MockRuntime) Deinit() { | |
| 41 | + | _mock.Called() | |
| 42 | + | return | |
| 43 | + | } | |
| 44 | + | ||
| 45 | + | // MockRuntime_Deinit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deinit' | |
| 46 | + | type MockRuntime_Deinit_Call struct { | |
| 47 | + | *mock.Call | |
| 48 | + | } | |
| 49 | + | ||
| 50 | + | // Deinit is a helper method to define mock.On call | |
| 51 | + | func (_e *MockRuntime_Expecter) Deinit() *MockRuntime_Deinit_Call { | |
| 52 | + | return &MockRuntime_Deinit_Call{Call: _e.mock.On("Deinit")} | |
| 53 | + | } | |
| 54 | + | ||
| 55 | + | func (_c *MockRuntime_Deinit_Call) Run(run func()) *MockRuntime_Deinit_Call { | |
| 56 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 57 | + | run() | |
| 58 | + | }) | |
| 59 | + | return _c | |
| 60 | + | } | |
| 61 | + | ||
| 62 | + | func (_c *MockRuntime_Deinit_Call) Return() *MockRuntime_Deinit_Call { | |
| 63 | + | _c.Call.Return() | |
| 64 | + | return _c | |
| 65 | + | } | |
| 66 | + | ||
| 67 | + | func (_c *MockRuntime_Deinit_Call) RunAndReturn(run func()) *MockRuntime_Deinit_Call { | |
| 68 | + | _c.Run(run) | |
| 69 | + | return _c | |
| 70 | + | } | |
| 71 | + | ||
| 72 | + | // Init provides a mock function for the type MockRuntime | |
| 73 | + | func (_mock *MockRuntime) Init() error { | |
| 74 | + | ret := _mock.Called() | |
| 75 | + | ||
| 76 | + | if len(ret) == 0 { | |
| 77 | + | panic("no return value specified for Init") | |
| 78 | + | } | |
| 79 | + | ||
| 80 | + | var r0 error | |
| 81 | + | if returnFunc, ok := ret.Get(0).(func() error); ok { | |
| 82 | + | r0 = returnFunc() | |
| 83 | + | } else { | |
| 84 | + | r0 = ret.Error(0) | |
| 85 | + | } | |
| 86 | + | return r0 | |
| 87 | + | } | |
| 88 | + | ||
| 89 | + | // MockRuntime_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init' | |
| 90 | + | type MockRuntime_Init_Call struct { | |
| 91 | + | *mock.Call | |
| 92 | + | } | |
| 93 | + | ||
| 94 | + | // Init is a helper method to define mock.On call | |
| 95 | + | func (_e *MockRuntime_Expecter) Init() *MockRuntime_Init_Call { | |
| 96 | + | return &MockRuntime_Init_Call{Call: _e.mock.On("Init")} | |
| 97 | + | } | |
| 98 | + | ||
| 99 | + | func (_c *MockRuntime_Init_Call) Run(run func()) *MockRuntime_Init_Call { | |
| 100 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 101 | + | run() | |
| 102 | + | }) | |
| 103 | + | return _c | |
| 104 | + | } | |
| 105 | + | ||
| 106 | + | func (_c *MockRuntime_Init_Call) Return(err error) *MockRuntime_Init_Call { | |
| 107 | + | _c.Call.Return(err) | |
| 108 | + | return _c | |
| 109 | + | } | |
| 110 | + | ||
| 111 | + | func (_c *MockRuntime_Init_Call) RunAndReturn(run func() error) *MockRuntime_Init_Call { | |
| 112 | + | _c.Call.Return(run) | |
| 113 | + | return _c | |
| 114 | + | } | |
| 115 | + | ||
| 116 | + | // NewMainLoop provides a mock function for the type MockRuntime | |
| 117 | + | func (_mock *MockRuntime) NewMainLoop() (pipewire.MainLoop, error) { | |
| 118 | + | ret := _mock.Called() | |
| 119 | + | ||
| 120 | + | if len(ret) == 0 { | |
| 121 | + | panic("no return value specified for NewMainLoop") | |
| 122 | + | } | |
| 123 | + | ||
| 124 | + | var r0 pipewire.MainLoop | |
| 125 | + | var r1 error | |
| 126 | + | if returnFunc, ok := ret.Get(0).(func() (pipewire.MainLoop, error)); ok { | |
| 127 | + | return returnFunc() | |
| 128 | + | } | |
| 129 | + | if returnFunc, ok := ret.Get(0).(func() pipewire.MainLoop); ok { | |
| 130 | + | r0 = returnFunc() | |
| 131 | + | } else { | |
| 132 | + | if ret.Get(0) != nil { | |
| 133 | + | r0 = ret.Get(0).(pipewire.MainLoop) | |
| 134 | + | } | |
| 135 | + | } | |
| 136 | + | if returnFunc, ok := ret.Get(1).(func() error); ok { | |
| 137 | + | r1 = returnFunc() | |
| 138 | + | } else { | |
| 139 | + | r1 = ret.Error(1) | |
| 140 | + | } | |
| 141 | + | return r0, r1 | |
| 142 | + | } | |
| 143 | + | ||
| 144 | + | // MockRuntime_NewMainLoop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewMainLoop' | |
| 145 | + | type MockRuntime_NewMainLoop_Call struct { | |
| 146 | + | *mock.Call | |
| 147 | + | } | |
| 148 | + | ||
| 149 | + | // NewMainLoop is a helper method to define mock.On call | |
| 150 | + | func (_e *MockRuntime_Expecter) NewMainLoop() *MockRuntime_NewMainLoop_Call { | |
| 151 | + | return &MockRuntime_NewMainLoop_Call{Call: _e.mock.On("NewMainLoop")} | |
| 152 | + | } | |
| 153 | + | ||
| 154 | + | func (_c *MockRuntime_NewMainLoop_Call) Run(run func()) *MockRuntime_NewMainLoop_Call { | |
| 155 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 156 | + | run() | |
| 157 | + | }) | |
| 158 | + | return _c | |
| 159 | + | } | |
| 160 | + | ||
| 161 | + | func (_c *MockRuntime_NewMainLoop_Call) Return(mainLoop pipewire.MainLoop, err error) *MockRuntime_NewMainLoop_Call { | |
| 162 | + | _c.Call.Return(mainLoop, err) | |
| 163 | + | return _c | |
| 164 | + | } | |
| 165 | + | ||
| 166 | + | func (_c *MockRuntime_NewMainLoop_Call) RunAndReturn(run func() (pipewire.MainLoop, error)) *MockRuntime_NewMainLoop_Call { | |
| 167 | + | _c.Call.Return(run) | |
| 168 | + | return _c | |
| 169 | + | } | |
| @@ -0,0 +1,169 @@ | |||||
| 1 | + | // Code generated by mockery; DO NOT EDIT. | |||
| 2 | + | // github.com/vektra/mockery | |||
| 3 | + | // template: testify | |||
| 4 | + | ||||
| 5 | + | package mocks | |||
| 6 | + | ||||
| 7 | + | import ( | |||
| 8 | + | "github.com/bnema/purego-pipewire/pipewire" | |||
| 9 | + | mock "github.com/stretchr/testify/mock" | |||
| 10 | + | ) | |||
| 11 | + | ||||
| 12 | + | // NewMockRuntime creates a new instance of MockRuntime. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |||
| 13 | + | // The first argument is typically a *testing.T value. | |||
| 14 | + | func NewMockRuntime(t interface { | |||
| 15 | + | mock.TestingT | |||
| 16 | + | Cleanup(func()) | |||
| 17 | + | }) *MockRuntime { | |||
| 18 | + | mock := &MockRuntime{} | |||
| 19 | + | mock.Mock.Test(t) | |||
| 20 | + | ||||
| 21 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 22 | + | ||||
| 23 | + | return mock | |||
| 24 | + | } | |||
| 25 | + | ||||
| 26 | + | // MockRuntime is an autogenerated mock type for the Runtime type | |||
| 27 | + | type MockRuntime struct { | |||
| 28 | + | mock.Mock | |||
| 29 | + | } | |||
| 30 | + | ||||
| 31 | + | type MockRuntime_Expecter struct { | |||
| 32 | + | mock *mock.Mock | |||
| 33 | + | } | |||
| 34 | + | ||||
| 35 | + | func (_m *MockRuntime) EXPECT() *MockRuntime_Expecter { | |||
| 36 | + | return &MockRuntime_Expecter{mock: &_m.Mock} | |||
| 37 | + | } | |||
| 38 | + | ||||
| 39 | + | // Deinit provides a mock function for the type MockRuntime | |||
| 40 | + | func (_mock *MockRuntime) Deinit() { | |||
| 41 | + | _mock.Called() | |||
| 42 | + | return | |||
| 43 | + | } | |||
| 44 | + | ||||
| 45 | + | // MockRuntime_Deinit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deinit' | |||
| 46 | + | type MockRuntime_Deinit_Call struct { | |||
| 47 | + | *mock.Call | |||
| 48 | + | } | |||
| 49 | + | ||||
| 50 | + | // Deinit is a helper method to define mock.On call | |||
| 51 | + | func (_e *MockRuntime_Expecter) Deinit() *MockRuntime_Deinit_Call { | |||
| 52 | + | return &MockRuntime_Deinit_Call{Call: _e.mock.On("Deinit")} | |||
| 53 | + | } | |||
| 54 | + | ||||
| 55 | + | func (_c *MockRuntime_Deinit_Call) Run(run func()) *MockRuntime_Deinit_Call { | |||
| 56 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 57 | + | run() | |||
| 58 | + | }) | |||
| 59 | + | return _c | |||
| 60 | + | } | |||
| 61 | + | ||||
| 62 | + | func (_c *MockRuntime_Deinit_Call) Return() *MockRuntime_Deinit_Call { | |||
| 63 | + | _c.Call.Return() | |||
| 64 | + | return _c | |||
| 65 | + | } | |||
| 66 | + | ||||
| 67 | + | func (_c *MockRuntime_Deinit_Call) RunAndReturn(run func()) *MockRuntime_Deinit_Call { | |||
| 68 | + | _c.Run(run) | |||
| 69 | + | return _c | |||
| 70 | + | } | |||
| 71 | + | ||||
| 72 | + | // Init provides a mock function for the type MockRuntime | |||
| 73 | + | func (_mock *MockRuntime) Init() error { | |||
| 74 | + | ret := _mock.Called() | |||
| 75 | + | ||||
| 76 | + | if len(ret) == 0 { | |||
| 77 | + | panic("no return value specified for Init") | |||
| 78 | + | } | |||
| 79 | + | ||||
| 80 | + | var r0 error | |||
| 81 | + | if returnFunc, ok := ret.Get(0).(func() error); ok { | |||
| 82 | + | r0 = returnFunc() | |||
| 83 | + | } else { | |||
| 84 | + | r0 = ret.Error(0) | |||
| 85 | + | } | |||
| 86 | + | return r0 | |||
| 87 | + | } | |||
| 88 | + | ||||
| 89 | + | // MockRuntime_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init' | |||
| 90 | + | type MockRuntime_Init_Call struct { | |||
| 91 | + | *mock.Call | |||
| 92 | + | } | |||
| 93 | + | ||||
| 94 | + | // Init is a helper method to define mock.On call | |||
| 95 | + | func (_e *MockRuntime_Expecter) Init() *MockRuntime_Init_Call { | |||
| 96 | + | return &MockRuntime_Init_Call{Call: _e.mock.On("Init")} | |||
| 97 | + | } | |||
| 98 | + | ||||
| 99 | + | func (_c *MockRuntime_Init_Call) Run(run func()) *MockRuntime_Init_Call { | |||
| 100 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 101 | + | run() | |||
| 102 | + | }) | |||
| 103 | + | return _c | |||
| 104 | + | } | |||
| 105 | + | ||||
| 106 | + | func (_c *MockRuntime_Init_Call) Return(err error) *MockRuntime_Init_Call { | |||
| 107 | + | _c.Call.Return(err) | |||
| 108 | + | return _c | |||
| 109 | + | } | |||
| 110 | + | ||||
| 111 | + | func (_c *MockRuntime_Init_Call) RunAndReturn(run func() error) *MockRuntime_Init_Call { | |||
| 112 | + | _c.Call.Return(run) | |||
| 113 | + | return _c | |||
| 114 | + | } | |||
| 115 | + | ||||
| 116 | + | // NewMainLoop provides a mock function for the type MockRuntime | |||
| 117 | + | func (_mock *MockRuntime) NewMainLoop() (pipewire.MainLoop, error) { | |||
| 118 | + | ret := _mock.Called() | |||
| 119 | + | ||||
| 120 | + | if len(ret) == 0 { | |||
| 121 | + | panic("no return value specified for NewMainLoop") | |||
| 122 | + | } | |||
| 123 | + | ||||
| 124 | + | var r0 pipewire.MainLoop | |||
| 125 | + | var r1 error | |||
| 126 | + | if returnFunc, ok := ret.Get(0).(func() (pipewire.MainLoop, error)); ok { | |||
| 127 | + | return returnFunc() | |||
| 128 | + | } | |||
| 129 | + | if returnFunc, ok := ret.Get(0).(func() pipewire.MainLoop); ok { | |||
| 130 | + | r0 = returnFunc() | |||
| 131 | + | } else { | |||
| 132 | + | if ret.Get(0) != nil { | |||
| 133 | + | r0 = ret.Get(0).(pipewire.MainLoop) | |||
| 134 | + | } | |||
| 135 | + | } | |||
| 136 | + | if returnFunc, ok := ret.Get(1).(func() error); ok { | |||
| 137 | + | r1 = returnFunc() | |||
| 138 | + | } else { | |||
| 139 | + | r1 = ret.Error(1) | |||
| 140 | + | } | |||
| 141 | + | return r0, r1 | |||
| 142 | + | } | |||
| 143 | + | ||||
| 144 | + | // MockRuntime_NewMainLoop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewMainLoop' | |||
| 145 | + | type MockRuntime_NewMainLoop_Call struct { | |||
| 146 | + | *mock.Call | |||
| 147 | + | } | |||
| 148 | + | ||||
| 149 | + | // NewMainLoop is a helper method to define mock.On call | |||
| 150 | + | func (_e *MockRuntime_Expecter) NewMainLoop() *MockRuntime_NewMainLoop_Call { | |||
| 151 | + | return &MockRuntime_NewMainLoop_Call{Call: _e.mock.On("NewMainLoop")} | |||
| 152 | + | } | |||
| 153 | + | ||||
| 154 | + | func (_c *MockRuntime_NewMainLoop_Call) Run(run func()) *MockRuntime_NewMainLoop_Call { | |||
| 155 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 156 | + | run() | |||
| 157 | + | }) | |||
| 158 | + | return _c | |||
| 159 | + | } | |||
| 160 | + | ||||
| 161 | + | func (_c *MockRuntime_NewMainLoop_Call) Return(mainLoop pipewire.MainLoop, err error) *MockRuntime_NewMainLoop_Call { | |||
| 162 | + | _c.Call.Return(mainLoop, err) | |||
| 163 | + | return _c | |||
| 164 | + | } | |||
| 165 | + | ||||
| 166 | + | func (_c *MockRuntime_NewMainLoop_Call) RunAndReturn(run func() (pipewire.MainLoop, error)) *MockRuntime_NewMainLoop_Call { | |||
| 167 | + | _c.Call.Return(run) | |||
| 168 | + | return _c | |||
| 169 | + | } | |||