mirror of
				https://github.com/go-task/task.git
				synced 2025-10-30 23:58:01 +02:00 
			
		
		
		
	feat: mockery v3 (#2110)
This commit is contained in:
		| @@ -1,4 +1,8 @@ | ||||
| with-expecter: true | ||||
| keeptree: true | ||||
| case: underscore | ||||
| output: ./internal/mocks | ||||
| all: False | ||||
| template: testify | ||||
| filename: '{{base (trimSuffix ".go" .InterfaceFile)}}_mock.go' | ||||
| packages: | ||||
|   github.com/go-task/task/v3/internal/fingerprint: | ||||
|     interfaces: | ||||
|       SourcesCheckable: | ||||
|       StatusCheckable: | ||||
|   | ||||
							
								
								
									
										17
									
								
								Taskfile.yml
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								Taskfile.yml
									
									
									
									
									
								
							| @@ -32,16 +32,23 @@ tasks: | ||||
|       - go install -v ./cmd/task | ||||
|  | ||||
|   generate: | ||||
|     desc: Runs Mockery to create mocks | ||||
|     aliases: [gen, g] | ||||
|     desc: Runs all generate tasks | ||||
|     cmds: | ||||
|       - task: generate:mocks | ||||
|       - task: generate:fixtures | ||||
|  | ||||
|   generate:mocks: | ||||
|     desc: Runs Mockery to create mocks | ||||
|     aliases: [gen:mocks, g:mocks] | ||||
|     deps: [install:mockery] | ||||
|     sources: | ||||
|       - "internal/fingerprint/checker.go" | ||||
|     generates: | ||||
|       - "internal/mocks/*.go" | ||||
|     cmds: | ||||
|       - "{{.BIN}}/mockery --dir ./internal/fingerprint --name SourcesCheckable" | ||||
|       - "{{.BIN}}/mockery --dir ./internal/fingerprint --name StatusCheckable" | ||||
|       - find . -type f -name *_mock.go -delete | ||||
|       - "{{.BIN}}/mockery" | ||||
|  | ||||
|   generate:fixtures: | ||||
|     desc: Runs tests and generates golden fixture files | ||||
| @@ -53,13 +60,13 @@ tasks: | ||||
|   install:mockery: | ||||
|     desc: Installs mockgen; a tool to generate mock files | ||||
|     vars: | ||||
|       MOCKERY_VERSION: v2.24.0 | ||||
|       MOCKERY_VERSION: v3.2.2 | ||||
|     env: | ||||
|       GOBIN: "{{.BIN}}" | ||||
|     status: | ||||
|       - go version -m {{.BIN}}/mockery | grep github.com/vektra/mockery | grep {{.MOCKERY_VERSION}} | ||||
|     cmds: | ||||
|       - go install github.com/vektra/mockery/v2@{{.MOCKERY_VERSION}} | ||||
|       - GOBIN="{{.BIN}}" go install github.com/vektra/mockery/v3@{{.MOCKERY_VERSION}} | ||||
|  | ||||
|   mod: | ||||
|     desc: Downloads and tidy Go modules | ||||
|   | ||||
							
								
								
									
										320
									
								
								internal/fingerprint/checker_mock.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										320
									
								
								internal/fingerprint/checker_mock.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,320 @@ | ||||
| // Code generated by mockery; DO NOT EDIT. | ||||
| // github.com/vektra/mockery | ||||
| // template: testify | ||||
|  | ||||
| package fingerprint | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| 	mock "github.com/stretchr/testify/mock" | ||||
| ) | ||||
|  | ||||
| // NewMockStatusCheckable creates a new instance of MockStatusCheckable. 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 NewMockStatusCheckable(t interface { | ||||
| 	mock.TestingT | ||||
| 	Cleanup(func()) | ||||
| }) *MockStatusCheckable { | ||||
| 	mock := &MockStatusCheckable{} | ||||
| 	mock.Mock.Test(t) | ||||
|  | ||||
| 	t.Cleanup(func() { mock.AssertExpectations(t) }) | ||||
|  | ||||
| 	return mock | ||||
| } | ||||
|  | ||||
| // MockStatusCheckable is an autogenerated mock type for the StatusCheckable type | ||||
| type MockStatusCheckable struct { | ||||
| 	mock.Mock | ||||
| } | ||||
|  | ||||
| type MockStatusCheckable_Expecter struct { | ||||
| 	mock *mock.Mock | ||||
| } | ||||
|  | ||||
| func (_m *MockStatusCheckable) EXPECT() *MockStatusCheckable_Expecter { | ||||
| 	return &MockStatusCheckable_Expecter{mock: &_m.Mock} | ||||
| } | ||||
|  | ||||
| // IsUpToDate provides a mock function for the type MockStatusCheckable | ||||
| func (_mock *MockStatusCheckable) IsUpToDate(ctx context.Context, t *ast.Task) (bool, error) { | ||||
| 	ret := _mock.Called(ctx, t) | ||||
|  | ||||
| 	if len(ret) == 0 { | ||||
| 		panic("no return value specified for IsUpToDate") | ||||
| 	} | ||||
|  | ||||
| 	var r0 bool | ||||
| 	var r1 error | ||||
| 	if returnFunc, ok := ret.Get(0).(func(context.Context, *ast.Task) (bool, error)); ok { | ||||
| 		return returnFunc(ctx, t) | ||||
| 	} | ||||
| 	if returnFunc, ok := ret.Get(0).(func(context.Context, *ast.Task) bool); ok { | ||||
| 		r0 = returnFunc(ctx, t) | ||||
| 	} else { | ||||
| 		r0 = ret.Get(0).(bool) | ||||
| 	} | ||||
| 	if returnFunc, ok := ret.Get(1).(func(context.Context, *ast.Task) error); ok { | ||||
| 		r1 = returnFunc(ctx, t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| 	} | ||||
| 	return r0, r1 | ||||
| } | ||||
|  | ||||
| // MockStatusCheckable_IsUpToDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsUpToDate' | ||||
| type MockStatusCheckable_IsUpToDate_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // IsUpToDate is a helper method to define mock.On call | ||||
| //   - ctx | ||||
| //   - t | ||||
| func (_e *MockStatusCheckable_Expecter) IsUpToDate(ctx interface{}, t interface{}) *MockStatusCheckable_IsUpToDate_Call { | ||||
| 	return &MockStatusCheckable_IsUpToDate_Call{Call: _e.mock.On("IsUpToDate", ctx, t)} | ||||
| } | ||||
|  | ||||
| func (_c *MockStatusCheckable_IsUpToDate_Call) Run(run func(ctx context.Context, t *ast.Task)) *MockStatusCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(context.Context), args[1].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockStatusCheckable_IsUpToDate_Call) Return(b bool, err error) *MockStatusCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(b, err) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockStatusCheckable_IsUpToDate_Call) RunAndReturn(run func(ctx context.Context, t *ast.Task) (bool, error)) *MockStatusCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| // NewMockSourcesCheckable creates a new instance of MockSourcesCheckable. 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 NewMockSourcesCheckable(t interface { | ||||
| 	mock.TestingT | ||||
| 	Cleanup(func()) | ||||
| }) *MockSourcesCheckable { | ||||
| 	mock := &MockSourcesCheckable{} | ||||
| 	mock.Mock.Test(t) | ||||
|  | ||||
| 	t.Cleanup(func() { mock.AssertExpectations(t) }) | ||||
|  | ||||
| 	return mock | ||||
| } | ||||
|  | ||||
| // MockSourcesCheckable is an autogenerated mock type for the SourcesCheckable type | ||||
| type MockSourcesCheckable struct { | ||||
| 	mock.Mock | ||||
| } | ||||
|  | ||||
| type MockSourcesCheckable_Expecter struct { | ||||
| 	mock *mock.Mock | ||||
| } | ||||
|  | ||||
| func (_m *MockSourcesCheckable) EXPECT() *MockSourcesCheckable_Expecter { | ||||
| 	return &MockSourcesCheckable_Expecter{mock: &_m.Mock} | ||||
| } | ||||
|  | ||||
| // IsUpToDate provides a mock function for the type MockSourcesCheckable | ||||
| func (_mock *MockSourcesCheckable) IsUpToDate(t *ast.Task) (bool, error) { | ||||
| 	ret := _mock.Called(t) | ||||
|  | ||||
| 	if len(ret) == 0 { | ||||
| 		panic("no return value specified for IsUpToDate") | ||||
| 	} | ||||
|  | ||||
| 	var r0 bool | ||||
| 	var r1 error | ||||
| 	if returnFunc, ok := ret.Get(0).(func(*ast.Task) (bool, error)); ok { | ||||
| 		return returnFunc(t) | ||||
| 	} | ||||
| 	if returnFunc, ok := ret.Get(0).(func(*ast.Task) bool); ok { | ||||
| 		r0 = returnFunc(t) | ||||
| 	} else { | ||||
| 		r0 = ret.Get(0).(bool) | ||||
| 	} | ||||
| 	if returnFunc, ok := ret.Get(1).(func(*ast.Task) error); ok { | ||||
| 		r1 = returnFunc(t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| 	} | ||||
| 	return r0, r1 | ||||
| } | ||||
|  | ||||
| // MockSourcesCheckable_IsUpToDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsUpToDate' | ||||
| type MockSourcesCheckable_IsUpToDate_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // IsUpToDate is a helper method to define mock.On call | ||||
| //   - t | ||||
| func (_e *MockSourcesCheckable_Expecter) IsUpToDate(t interface{}) *MockSourcesCheckable_IsUpToDate_Call { | ||||
| 	return &MockSourcesCheckable_IsUpToDate_Call{Call: _e.mock.On("IsUpToDate", t)} | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_IsUpToDate_Call) Run(run func(t *ast.Task)) *MockSourcesCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_IsUpToDate_Call) Return(b bool, err error) *MockSourcesCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(b, err) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_IsUpToDate_Call) RunAndReturn(run func(t *ast.Task) (bool, error)) *MockSourcesCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| // Kind provides a mock function for the type MockSourcesCheckable | ||||
| func (_mock *MockSourcesCheckable) Kind() string { | ||||
| 	ret := _mock.Called() | ||||
|  | ||||
| 	if len(ret) == 0 { | ||||
| 		panic("no return value specified for Kind") | ||||
| 	} | ||||
|  | ||||
| 	var r0 string | ||||
| 	if returnFunc, ok := ret.Get(0).(func() string); ok { | ||||
| 		r0 = returnFunc() | ||||
| 	} else { | ||||
| 		r0 = ret.Get(0).(string) | ||||
| 	} | ||||
| 	return r0 | ||||
| } | ||||
|  | ||||
| // MockSourcesCheckable_Kind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Kind' | ||||
| type MockSourcesCheckable_Kind_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // Kind is a helper method to define mock.On call | ||||
| func (_e *MockSourcesCheckable_Expecter) Kind() *MockSourcesCheckable_Kind_Call { | ||||
| 	return &MockSourcesCheckable_Kind_Call{Call: _e.mock.On("Kind")} | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_Kind_Call) Run(run func()) *MockSourcesCheckable_Kind_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run() | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_Kind_Call) Return(s string) *MockSourcesCheckable_Kind_Call { | ||||
| 	_c.Call.Return(s) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_Kind_Call) RunAndReturn(run func() string) *MockSourcesCheckable_Kind_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| // OnError provides a mock function for the type MockSourcesCheckable | ||||
| func (_mock *MockSourcesCheckable) OnError(t *ast.Task) error { | ||||
| 	ret := _mock.Called(t) | ||||
|  | ||||
| 	if len(ret) == 0 { | ||||
| 		panic("no return value specified for OnError") | ||||
| 	} | ||||
|  | ||||
| 	var r0 error | ||||
| 	if returnFunc, ok := ret.Get(0).(func(*ast.Task) error); ok { | ||||
| 		r0 = returnFunc(t) | ||||
| 	} else { | ||||
| 		r0 = ret.Error(0) | ||||
| 	} | ||||
| 	return r0 | ||||
| } | ||||
|  | ||||
| // MockSourcesCheckable_OnError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnError' | ||||
| type MockSourcesCheckable_OnError_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // OnError is a helper method to define mock.On call | ||||
| //   - t | ||||
| func (_e *MockSourcesCheckable_Expecter) OnError(t interface{}) *MockSourcesCheckable_OnError_Call { | ||||
| 	return &MockSourcesCheckable_OnError_Call{Call: _e.mock.On("OnError", t)} | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_OnError_Call) Run(run func(t *ast.Task)) *MockSourcesCheckable_OnError_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_OnError_Call) Return(err error) *MockSourcesCheckable_OnError_Call { | ||||
| 	_c.Call.Return(err) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_OnError_Call) RunAndReturn(run func(t *ast.Task) error) *MockSourcesCheckable_OnError_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| // Value provides a mock function for the type MockSourcesCheckable | ||||
| func (_mock *MockSourcesCheckable) Value(t *ast.Task) (any, error) { | ||||
| 	ret := _mock.Called(t) | ||||
|  | ||||
| 	if len(ret) == 0 { | ||||
| 		panic("no return value specified for Value") | ||||
| 	} | ||||
|  | ||||
| 	var r0 any | ||||
| 	var r1 error | ||||
| 	if returnFunc, ok := ret.Get(0).(func(*ast.Task) (any, error)); ok { | ||||
| 		return returnFunc(t) | ||||
| 	} | ||||
| 	if returnFunc, ok := ret.Get(0).(func(*ast.Task) any); ok { | ||||
| 		r0 = returnFunc(t) | ||||
| 	} else { | ||||
| 		if ret.Get(0) != nil { | ||||
| 			r0 = ret.Get(0).(any) | ||||
| 		} | ||||
| 	} | ||||
| 	if returnFunc, ok := ret.Get(1).(func(*ast.Task) error); ok { | ||||
| 		r1 = returnFunc(t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| 	} | ||||
| 	return r0, r1 | ||||
| } | ||||
|  | ||||
| // MockSourcesCheckable_Value_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Value' | ||||
| type MockSourcesCheckable_Value_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // Value is a helper method to define mock.On call | ||||
| //   - t | ||||
| func (_e *MockSourcesCheckable_Expecter) Value(t interface{}) *MockSourcesCheckable_Value_Call { | ||||
| 	return &MockSourcesCheckable_Value_Call{Call: _e.mock.On("Value", t)} | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_Value_Call) Run(run func(t *ast.Task)) *MockSourcesCheckable_Value_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_Value_Call) Return(v any, err error) *MockSourcesCheckable_Value_Call { | ||||
| 	_c.Call.Return(v, err) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *MockSourcesCheckable_Value_Call) RunAndReturn(run func(t *ast.Task) (any, error)) *MockSourcesCheckable_Value_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
| @@ -8,7 +8,6 @@ import ( | ||||
| 	"github.com/stretchr/testify/mock" | ||||
| 	"github.com/stretchr/testify/require" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/mocks" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| @@ -31,8 +30,8 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 	tests := []struct { | ||||
| 		name                    string | ||||
| 		task                    *ast.Task | ||||
| 		setupMockStatusChecker  func(m *mocks.StatusCheckable) | ||||
| 		setupMockSourcesChecker func(m *mocks.SourcesCheckable) | ||||
| 		setupMockStatusChecker  func(m *MockStatusCheckable) | ||||
| 		setupMockSourcesChecker func(m *MockSourcesCheckable) | ||||
| 		expected                bool | ||||
| 	}{ | ||||
| 		{ | ||||
| @@ -52,7 +51,7 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: nil, | ||||
| 			setupMockSourcesChecker: func(m *mocks.SourcesCheckable) { | ||||
| 			setupMockSourcesChecker: func(m *MockSourcesCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything).Return(true, nil) | ||||
| 			}, | ||||
| 			expected: true, | ||||
| @@ -64,7 +63,7 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: nil, | ||||
| 			setupMockSourcesChecker: func(m *mocks.SourcesCheckable) { | ||||
| 			setupMockSourcesChecker: func(m *MockSourcesCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything).Return(false, nil) | ||||
| 			}, | ||||
| 			expected: false, | ||||
| @@ -75,7 +74,7 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: nil, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 			setupMockStatusChecker: func(m *MockStatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(true, nil) | ||||
| 			}, | ||||
| 			setupMockSourcesChecker: nil, | ||||
| @@ -87,10 +86,10 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 			setupMockStatusChecker: func(m *MockStatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(true, nil) | ||||
| 			}, | ||||
| 			setupMockSourcesChecker: func(m *mocks.SourcesCheckable) { | ||||
| 			setupMockSourcesChecker: func(m *MockSourcesCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything).Return(true, nil) | ||||
| 			}, | ||||
| 			expected: true, | ||||
| @@ -101,10 +100,10 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 			setupMockStatusChecker: func(m *MockStatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(true, nil) | ||||
| 			}, | ||||
| 			setupMockSourcesChecker: func(m *mocks.SourcesCheckable) { | ||||
| 			setupMockSourcesChecker: func(m *MockSourcesCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything).Return(false, nil) | ||||
| 			}, | ||||
| 			expected: false, | ||||
| @@ -115,7 +114,7 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: nil, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 			setupMockStatusChecker: func(m *MockStatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(false, nil) | ||||
| 			}, | ||||
| 			setupMockSourcesChecker: nil, | ||||
| @@ -127,10 +126,10 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 			setupMockStatusChecker: func(m *MockStatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(false, nil) | ||||
| 			}, | ||||
| 			setupMockSourcesChecker: func(m *mocks.SourcesCheckable) { | ||||
| 			setupMockSourcesChecker: func(m *MockSourcesCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything).Return(true, nil) | ||||
| 			}, | ||||
| 			expected: false, | ||||
| @@ -141,10 +140,10 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 			setupMockStatusChecker: func(m *MockStatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(false, nil) | ||||
| 			}, | ||||
| 			setupMockSourcesChecker: func(m *mocks.SourcesCheckable) { | ||||
| 			setupMockSourcesChecker: func(m *MockSourcesCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything).Return(false, nil) | ||||
| 			}, | ||||
| 			expected: false, | ||||
| @@ -154,12 +153,12 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		t.Run(tt.name, func(t *testing.T) { | ||||
| 			t.Parallel() | ||||
|  | ||||
| 			mockStatusChecker := mocks.NewStatusCheckable(t) | ||||
| 			mockStatusChecker := NewMockStatusCheckable(t) | ||||
| 			if tt.setupMockStatusChecker != nil { | ||||
| 				tt.setupMockStatusChecker(mockStatusChecker) | ||||
| 			} | ||||
|  | ||||
| 			mockSourcesChecker := mocks.NewSourcesCheckable(t) | ||||
| 			mockSourcesChecker := NewMockSourcesCheckable(t) | ||||
| 			if tt.setupMockSourcesChecker != nil { | ||||
| 				tt.setupMockSourcesChecker(mockSourcesChecker) | ||||
| 			} | ||||
|   | ||||
| @@ -1,226 +0,0 @@ | ||||
| // Code generated by mockery v2.24.0. DO NOT EDIT. | ||||
|  | ||||
| package mocks | ||||
|  | ||||
| import ( | ||||
| 	ast "github.com/go-task/task/v3/taskfile/ast" | ||||
|  | ||||
| 	mock "github.com/stretchr/testify/mock" | ||||
| ) | ||||
|  | ||||
| // SourcesCheckable is an autogenerated mock type for the SourcesCheckable type | ||||
| type SourcesCheckable struct { | ||||
| 	mock.Mock | ||||
| } | ||||
|  | ||||
| type SourcesCheckable_Expecter struct { | ||||
| 	mock *mock.Mock | ||||
| } | ||||
|  | ||||
| func (_m *SourcesCheckable) EXPECT() *SourcesCheckable_Expecter { | ||||
| 	return &SourcesCheckable_Expecter{mock: &_m.Mock} | ||||
| } | ||||
|  | ||||
| // IsUpToDate provides a mock function with given fields: t | ||||
| func (_m *SourcesCheckable) IsUpToDate(t *ast.Task) (bool, error) { | ||||
| 	ret := _m.Called(t) | ||||
|  | ||||
| 	var r0 bool | ||||
| 	var r1 error | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) (bool, error)); ok { | ||||
| 		return rf(t) | ||||
| 	} | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) bool); ok { | ||||
| 		r0 = rf(t) | ||||
| 	} else { | ||||
| 		r0 = ret.Get(0).(bool) | ||||
| 	} | ||||
|  | ||||
| 	if rf, ok := ret.Get(1).(func(*ast.Task) error); ok { | ||||
| 		r1 = rf(t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| 	} | ||||
|  | ||||
| 	return r0, r1 | ||||
| } | ||||
|  | ||||
| // SourcesCheckable_IsUpToDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsUpToDate' | ||||
| type SourcesCheckable_IsUpToDate_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // IsUpToDate is a helper method to define mock.On call | ||||
| //   - t *ast.Task | ||||
| func (_e *SourcesCheckable_Expecter) IsUpToDate(t interface{}) *SourcesCheckable_IsUpToDate_Call { | ||||
| 	return &SourcesCheckable_IsUpToDate_Call{Call: _e.mock.On("IsUpToDate", t)} | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_IsUpToDate_Call) Run(run func(t *ast.Task)) *SourcesCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_IsUpToDate_Call) Return(_a0 bool, _a1 error) *SourcesCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(_a0, _a1) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_IsUpToDate_Call) RunAndReturn(run func(*ast.Task) (bool, error)) *SourcesCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| // Kind provides a mock function with given fields: | ||||
| func (_m *SourcesCheckable) Kind() string { | ||||
| 	ret := _m.Called() | ||||
|  | ||||
| 	var r0 string | ||||
| 	if rf, ok := ret.Get(0).(func() string); ok { | ||||
| 		r0 = rf() | ||||
| 	} else { | ||||
| 		r0 = ret.Get(0).(string) | ||||
| 	} | ||||
|  | ||||
| 	return r0 | ||||
| } | ||||
|  | ||||
| // SourcesCheckable_Kind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Kind' | ||||
| type SourcesCheckable_Kind_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // Kind is a helper method to define mock.On call | ||||
| func (_e *SourcesCheckable_Expecter) Kind() *SourcesCheckable_Kind_Call { | ||||
| 	return &SourcesCheckable_Kind_Call{Call: _e.mock.On("Kind")} | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_Kind_Call) Run(run func()) *SourcesCheckable_Kind_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run() | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_Kind_Call) Return(_a0 string) *SourcesCheckable_Kind_Call { | ||||
| 	_c.Call.Return(_a0) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_Kind_Call) RunAndReturn(run func() string) *SourcesCheckable_Kind_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| // OnError provides a mock function with given fields: t | ||||
| func (_m *SourcesCheckable) OnError(t *ast.Task) error { | ||||
| 	ret := _m.Called(t) | ||||
|  | ||||
| 	var r0 error | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) error); ok { | ||||
| 		r0 = rf(t) | ||||
| 	} else { | ||||
| 		r0 = ret.Error(0) | ||||
| 	} | ||||
|  | ||||
| 	return r0 | ||||
| } | ||||
|  | ||||
| // SourcesCheckable_OnError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnError' | ||||
| type SourcesCheckable_OnError_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // OnError is a helper method to define mock.On call | ||||
| //   - t *ast.Task | ||||
| func (_e *SourcesCheckable_Expecter) OnError(t interface{}) *SourcesCheckable_OnError_Call { | ||||
| 	return &SourcesCheckable_OnError_Call{Call: _e.mock.On("OnError", t)} | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_OnError_Call) Run(run func(t *ast.Task)) *SourcesCheckable_OnError_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_OnError_Call) Return(_a0 error) *SourcesCheckable_OnError_Call { | ||||
| 	_c.Call.Return(_a0) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_OnError_Call) RunAndReturn(run func(*ast.Task) error) *SourcesCheckable_OnError_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| // Value provides a mock function with given fields: t | ||||
| func (_m *SourcesCheckable) Value(t *ast.Task) (interface{}, error) { | ||||
| 	ret := _m.Called(t) | ||||
|  | ||||
| 	var r0 interface{} | ||||
| 	var r1 error | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) (interface{}, error)); ok { | ||||
| 		return rf(t) | ||||
| 	} | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) interface{}); ok { | ||||
| 		r0 = rf(t) | ||||
| 	} else { | ||||
| 		if ret.Get(0) != nil { | ||||
| 			r0 = ret.Get(0).(interface{}) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if rf, ok := ret.Get(1).(func(*ast.Task) error); ok { | ||||
| 		r1 = rf(t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| 	} | ||||
|  | ||||
| 	return r0, r1 | ||||
| } | ||||
|  | ||||
| // SourcesCheckable_Value_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Value' | ||||
| type SourcesCheckable_Value_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // Value is a helper method to define mock.On call | ||||
| //   - t *ast.Task | ||||
| func (_e *SourcesCheckable_Expecter) Value(t interface{}) *SourcesCheckable_Value_Call { | ||||
| 	return &SourcesCheckable_Value_Call{Call: _e.mock.On("Value", t)} | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_Value_Call) Run(run func(t *ast.Task)) *SourcesCheckable_Value_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_Value_Call) Return(_a0 interface{}, _a1 error) *SourcesCheckable_Value_Call { | ||||
| 	_c.Call.Return(_a0, _a1) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_Value_Call) RunAndReturn(run func(*ast.Task) (interface{}, error)) *SourcesCheckable_Value_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| type mockConstructorTestingTNewSourcesCheckable interface { | ||||
| 	mock.TestingT | ||||
| 	Cleanup(func()) | ||||
| } | ||||
|  | ||||
| // NewSourcesCheckable creates a new instance of SourcesCheckable. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | ||||
| func NewSourcesCheckable(t mockConstructorTestingTNewSourcesCheckable) *SourcesCheckable { | ||||
| 	mock := &SourcesCheckable{} | ||||
| 	mock.Mock.Test(t) | ||||
|  | ||||
| 	t.Cleanup(func() { mock.AssertExpectations(t) }) | ||||
|  | ||||
| 	return mock | ||||
| } | ||||
| @@ -1,92 +0,0 @@ | ||||
| // Code generated by mockery v2.24.0. DO NOT EDIT. | ||||
|  | ||||
| package mocks | ||||
|  | ||||
| import ( | ||||
| 	context "context" | ||||
|  | ||||
| 	ast "github.com/go-task/task/v3/taskfile/ast" | ||||
|  | ||||
| 	mock "github.com/stretchr/testify/mock" | ||||
| ) | ||||
|  | ||||
| // StatusCheckable is an autogenerated mock type for the StatusCheckable type | ||||
| type StatusCheckable struct { | ||||
| 	mock.Mock | ||||
| } | ||||
|  | ||||
| type StatusCheckable_Expecter struct { | ||||
| 	mock *mock.Mock | ||||
| } | ||||
|  | ||||
| func (_m *StatusCheckable) EXPECT() *StatusCheckable_Expecter { | ||||
| 	return &StatusCheckable_Expecter{mock: &_m.Mock} | ||||
| } | ||||
|  | ||||
| // IsUpToDate provides a mock function with given fields: ctx, t | ||||
| func (_m *StatusCheckable) IsUpToDate(ctx context.Context, t *ast.Task) (bool, error) { | ||||
| 	ret := _m.Called(ctx, t) | ||||
|  | ||||
| 	var r0 bool | ||||
| 	var r1 error | ||||
| 	if rf, ok := ret.Get(0).(func(context.Context, *ast.Task) (bool, error)); ok { | ||||
| 		return rf(ctx, t) | ||||
| 	} | ||||
| 	if rf, ok := ret.Get(0).(func(context.Context, *ast.Task) bool); ok { | ||||
| 		r0 = rf(ctx, t) | ||||
| 	} else { | ||||
| 		r0 = ret.Get(0).(bool) | ||||
| 	} | ||||
|  | ||||
| 	if rf, ok := ret.Get(1).(func(context.Context, *ast.Task) error); ok { | ||||
| 		r1 = rf(ctx, t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| 	} | ||||
|  | ||||
| 	return r0, r1 | ||||
| } | ||||
|  | ||||
| // StatusCheckable_IsUpToDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsUpToDate' | ||||
| type StatusCheckable_IsUpToDate_Call struct { | ||||
| 	*mock.Call | ||||
| } | ||||
|  | ||||
| // IsUpToDate is a helper method to define mock.On call | ||||
| //   - ctx context.Context | ||||
| //   - t *ast.Task | ||||
| func (_e *StatusCheckable_Expecter) IsUpToDate(ctx interface{}, t interface{}) *StatusCheckable_IsUpToDate_Call { | ||||
| 	return &StatusCheckable_IsUpToDate_Call{Call: _e.mock.On("IsUpToDate", ctx, t)} | ||||
| } | ||||
|  | ||||
| func (_c *StatusCheckable_IsUpToDate_Call) Run(run func(ctx context.Context, t *ast.Task)) *StatusCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(context.Context), args[1].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *StatusCheckable_IsUpToDate_Call) Return(_a0 bool, _a1 error) *StatusCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(_a0, _a1) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *StatusCheckable_IsUpToDate_Call) RunAndReturn(run func(context.Context, *ast.Task) (bool, error)) *StatusCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| type mockConstructorTestingTNewStatusCheckable interface { | ||||
| 	mock.TestingT | ||||
| 	Cleanup(func()) | ||||
| } | ||||
|  | ||||
| // NewStatusCheckable creates a new instance of StatusCheckable. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | ||||
| func NewStatusCheckable(t mockConstructorTestingTNewStatusCheckable) *StatusCheckable { | ||||
| 	mock := &StatusCheckable{} | ||||
| 	mock.Mock.Test(t) | ||||
|  | ||||
| 	t.Cleanup(func() { mock.AssertExpectations(t) }) | ||||
|  | ||||
| 	return mock | ||||
| } | ||||
		Reference in New Issue
	
	Block a user