Go 1.19: fix comment formatting for moq-generated mocks

This commit is contained in:
Mislav Marohnić 2022-12-12 16:58:25 +01:00
parent 684a4c5c8c
commit e4f5545e86
No known key found for this signature in database
7 changed files with 309 additions and 257 deletions

View file

@ -13,43 +13,43 @@ var _ Config = &ConfigMock{}
// ConfigMock is a mock implementation of Config.
//
// func TestSomethingThatUsesConfig(t *testing.T) {
// func TestSomethingThatUsesConfig(t *testing.T) {
//
// // make and configure a mocked Config
// mockedConfig := &ConfigMock{
// AliasesFunc: func() *AliasConfig {
// panic("mock out the Aliases method")
// },
// AuthTokenFunc: func(s string) (string, string) {
// panic("mock out the AuthToken method")
// },
// DefaultHostFunc: func() (string, string) {
// panic("mock out the DefaultHost method")
// },
// GetFunc: func(s1 string, s2 string) (string, error) {
// panic("mock out the Get method")
// },
// GetOrDefaultFunc: func(s1 string, s2 string) (string, error) {
// panic("mock out the GetOrDefault method")
// },
// HostsFunc: func() []string {
// panic("mock out the Hosts method")
// },
// SetFunc: func(s1 string, s2 string, s3 string) {
// panic("mock out the Set method")
// },
// UnsetHostFunc: func(s string) {
// panic("mock out the UnsetHost method")
// },
// WriteFunc: func() error {
// panic("mock out the Write method")
// },
// }
// // make and configure a mocked Config
// mockedConfig := &ConfigMock{
// AliasesFunc: func() *AliasConfig {
// panic("mock out the Aliases method")
// },
// AuthTokenFunc: func(s string) (string, string) {
// panic("mock out the AuthToken method")
// },
// DefaultHostFunc: func() (string, string) {
// panic("mock out the DefaultHost method")
// },
// GetFunc: func(s1 string, s2 string) (string, error) {
// panic("mock out the Get method")
// },
// GetOrDefaultFunc: func(s1 string, s2 string) (string, error) {
// panic("mock out the GetOrDefault method")
// },
// HostsFunc: func() []string {
// panic("mock out the Hosts method")
// },
// SetFunc: func(s1 string, s2 string, s3 string) {
// panic("mock out the Set method")
// },
// UnsetHostFunc: func(s string) {
// panic("mock out the UnsetHost method")
// },
// WriteFunc: func() error {
// panic("mock out the Write method")
// },
// }
//
// // use mockedConfig in code that requires Config
// // and then make assertions.
// // use mockedConfig in code that requires Config
// // and then make assertions.
//
// }
// }
type ConfigMock struct {
// AliasesFunc mocks the Aliases method.
AliasesFunc func() *AliasConfig
@ -152,7 +152,8 @@ func (mock *ConfigMock) Aliases() *AliasConfig {
// AliasesCalls gets all the calls that were made to Aliases.
// Check the length with:
// len(mockedConfig.AliasesCalls())
//
// len(mockedConfig.AliasesCalls())
func (mock *ConfigMock) AliasesCalls() []struct {
} {
var calls []struct {
@ -181,7 +182,8 @@ func (mock *ConfigMock) AuthToken(s string) (string, string) {
// AuthTokenCalls gets all the calls that were made to AuthToken.
// Check the length with:
// len(mockedConfig.AuthTokenCalls())
//
// len(mockedConfig.AuthTokenCalls())
func (mock *ConfigMock) AuthTokenCalls() []struct {
S string
} {
@ -209,7 +211,8 @@ func (mock *ConfigMock) DefaultHost() (string, string) {
// DefaultHostCalls gets all the calls that were made to DefaultHost.
// Check the length with:
// len(mockedConfig.DefaultHostCalls())
//
// len(mockedConfig.DefaultHostCalls())
func (mock *ConfigMock) DefaultHostCalls() []struct {
} {
var calls []struct {
@ -240,7 +243,8 @@ func (mock *ConfigMock) Get(s1 string, s2 string) (string, error) {
// GetCalls gets all the calls that were made to Get.
// Check the length with:
// len(mockedConfig.GetCalls())
//
// len(mockedConfig.GetCalls())
func (mock *ConfigMock) GetCalls() []struct {
S1 string
S2 string
@ -275,7 +279,8 @@ func (mock *ConfigMock) GetOrDefault(s1 string, s2 string) (string, error) {
// GetOrDefaultCalls gets all the calls that were made to GetOrDefault.
// Check the length with:
// len(mockedConfig.GetOrDefaultCalls())
//
// len(mockedConfig.GetOrDefaultCalls())
func (mock *ConfigMock) GetOrDefaultCalls() []struct {
S1 string
S2 string
@ -305,7 +310,8 @@ func (mock *ConfigMock) Hosts() []string {
// HostsCalls gets all the calls that were made to Hosts.
// Check the length with:
// len(mockedConfig.HostsCalls())
//
// len(mockedConfig.HostsCalls())
func (mock *ConfigMock) HostsCalls() []struct {
} {
var calls []struct {
@ -338,7 +344,8 @@ func (mock *ConfigMock) Set(s1 string, s2 string, s3 string) {
// SetCalls gets all the calls that were made to Set.
// Check the length with:
// len(mockedConfig.SetCalls())
//
// len(mockedConfig.SetCalls())
func (mock *ConfigMock) SetCalls() []struct {
S1 string
S2 string
@ -373,7 +380,8 @@ func (mock *ConfigMock) UnsetHost(s string) {
// UnsetHostCalls gets all the calls that were made to UnsetHost.
// Check the length with:
// len(mockedConfig.UnsetHostCalls())
//
// len(mockedConfig.UnsetHostCalls())
func (mock *ConfigMock) UnsetHostCalls() []struct {
S string
} {
@ -401,7 +409,8 @@ func (mock *ConfigMock) Write() error {
// WriteCalls gets all the calls that were made to Write.
// Check the length with:
// len(mockedConfig.WriteCalls())
//
// len(mockedConfig.WriteCalls())
func (mock *ConfigMock) WriteCalls() []struct {
} {
var calls []struct {

View file

@ -13,43 +13,43 @@ var _ Prompter = &PrompterMock{}
// PrompterMock is a mock implementation of Prompter.
//
// func TestSomethingThatUsesPrompter(t *testing.T) {
// func TestSomethingThatUsesPrompter(t *testing.T) {
//
// // make and configure a mocked Prompter
// mockedPrompter := &PrompterMock{
// AuthTokenFunc: func() (string, error) {
// panic("mock out the AuthToken method")
// },
// ConfirmFunc: func(s string, b bool) (bool, error) {
// panic("mock out the Confirm method")
// },
// ConfirmDeletionFunc: func(s string) error {
// panic("mock out the ConfirmDeletion method")
// },
// InputFunc: func(s1 string, s2 string) (string, error) {
// panic("mock out the Input method")
// },
// InputHostnameFunc: func() (string, error) {
// panic("mock out the InputHostname method")
// },
// MarkdownEditorFunc: func(s1 string, s2 string, b bool) (string, error) {
// panic("mock out the MarkdownEditor method")
// },
// MultiSelectFunc: func(s1 string, s2 string, strings []string) (int, error) {
// panic("mock out the MultiSelect method")
// },
// PasswordFunc: func(s string) (string, error) {
// panic("mock out the Password method")
// },
// SelectFunc: func(s1 string, s2 string, strings []string) (int, error) {
// panic("mock out the Select method")
// },
// }
// // make and configure a mocked Prompter
// mockedPrompter := &PrompterMock{
// AuthTokenFunc: func() (string, error) {
// panic("mock out the AuthToken method")
// },
// ConfirmFunc: func(s string, b bool) (bool, error) {
// panic("mock out the Confirm method")
// },
// ConfirmDeletionFunc: func(s string) error {
// panic("mock out the ConfirmDeletion method")
// },
// InputFunc: func(s1 string, s2 string) (string, error) {
// panic("mock out the Input method")
// },
// InputHostnameFunc: func() (string, error) {
// panic("mock out the InputHostname method")
// },
// MarkdownEditorFunc: func(s1 string, s2 string, b bool) (string, error) {
// panic("mock out the MarkdownEditor method")
// },
// MultiSelectFunc: func(s1 string, s2 string, strings []string) (int, error) {
// panic("mock out the MultiSelect method")
// },
// PasswordFunc: func(s string) (string, error) {
// panic("mock out the Password method")
// },
// SelectFunc: func(s1 string, s2 string, strings []string) (int, error) {
// panic("mock out the Select method")
// },
// }
//
// // use mockedPrompter in code that requires Prompter
// // and then make assertions.
// // use mockedPrompter in code that requires Prompter
// // and then make assertions.
//
// }
// }
type PrompterMock struct {
// AuthTokenFunc mocks the AuthToken method.
AuthTokenFunc func() (string, error)
@ -164,7 +164,8 @@ func (mock *PrompterMock) AuthToken() (string, error) {
// AuthTokenCalls gets all the calls that were made to AuthToken.
// Check the length with:
// len(mockedPrompter.AuthTokenCalls())
//
// len(mockedPrompter.AuthTokenCalls())
func (mock *PrompterMock) AuthTokenCalls() []struct {
} {
var calls []struct {
@ -195,7 +196,8 @@ func (mock *PrompterMock) Confirm(s string, b bool) (bool, error) {
// ConfirmCalls gets all the calls that were made to Confirm.
// Check the length with:
// len(mockedPrompter.ConfirmCalls())
//
// len(mockedPrompter.ConfirmCalls())
func (mock *PrompterMock) ConfirmCalls() []struct {
S string
B bool
@ -228,7 +230,8 @@ func (mock *PrompterMock) ConfirmDeletion(s string) error {
// ConfirmDeletionCalls gets all the calls that were made to ConfirmDeletion.
// Check the length with:
// len(mockedPrompter.ConfirmDeletionCalls())
//
// len(mockedPrompter.ConfirmDeletionCalls())
func (mock *PrompterMock) ConfirmDeletionCalls() []struct {
S string
} {
@ -261,7 +264,8 @@ func (mock *PrompterMock) Input(s1 string, s2 string) (string, error) {
// InputCalls gets all the calls that were made to Input.
// Check the length with:
// len(mockedPrompter.InputCalls())
//
// len(mockedPrompter.InputCalls())
func (mock *PrompterMock) InputCalls() []struct {
S1 string
S2 string
@ -291,7 +295,8 @@ func (mock *PrompterMock) InputHostname() (string, error) {
// InputHostnameCalls gets all the calls that were made to InputHostname.
// Check the length with:
// len(mockedPrompter.InputHostnameCalls())
//
// len(mockedPrompter.InputHostnameCalls())
func (mock *PrompterMock) InputHostnameCalls() []struct {
} {
var calls []struct {
@ -324,7 +329,8 @@ func (mock *PrompterMock) MarkdownEditor(s1 string, s2 string, b bool) (string,
// MarkdownEditorCalls gets all the calls that were made to MarkdownEditor.
// Check the length with:
// len(mockedPrompter.MarkdownEditorCalls())
//
// len(mockedPrompter.MarkdownEditorCalls())
func (mock *PrompterMock) MarkdownEditorCalls() []struct {
S1 string
S2 string
@ -363,7 +369,8 @@ func (mock *PrompterMock) MultiSelect(s1 string, s2 string, strings []string) (i
// MultiSelectCalls gets all the calls that were made to MultiSelect.
// Check the length with:
// len(mockedPrompter.MultiSelectCalls())
//
// len(mockedPrompter.MultiSelectCalls())
func (mock *PrompterMock) MultiSelectCalls() []struct {
S1 string
S2 string
@ -398,7 +405,8 @@ func (mock *PrompterMock) Password(s string) (string, error) {
// PasswordCalls gets all the calls that were made to Password.
// Check the length with:
// len(mockedPrompter.PasswordCalls())
//
// len(mockedPrompter.PasswordCalls())
func (mock *PrompterMock) PasswordCalls() []struct {
S string
} {
@ -433,7 +441,8 @@ func (mock *PrompterMock) Select(s1 string, s2 string, strings []string) (int, e
// SelectCalls gets all the calls that were made to Select.
// Check the length with:
// len(mockedPrompter.SelectCalls())
//
// len(mockedPrompter.SelectCalls())
func (mock *PrompterMock) SelectCalls() []struct {
S1 string
S2 string

View file

@ -12,58 +12,58 @@ import (
// apiClientMock is a mock implementation of apiClient.
//
// func TestSomethingThatUsesapiClient(t *testing.T) {
// func TestSomethingThatUsesapiClient(t *testing.T) {
//
// // make and configure a mocked apiClient
// mockedapiClient := &apiClientMock{
// CreateCodespaceFunc: func(ctx context.Context, params *api.CreateCodespaceParams) (*api.Codespace, error) {
// panic("mock out the CreateCodespace method")
// },
// DeleteCodespaceFunc: func(ctx context.Context, name string, orgName string, userName string) error {
// panic("mock out the DeleteCodespace method")
// },
// EditCodespaceFunc: func(ctx context.Context, codespaceName string, params *api.EditCodespaceParams) (*api.Codespace, error) {
// panic("mock out the EditCodespace method")
// },
// GetCodespaceFunc: func(ctx context.Context, name string, includeConnection bool) (*api.Codespace, error) {
// panic("mock out the GetCodespace method")
// },
// GetCodespaceBillableOwnerFunc: func(ctx context.Context, nwo string) (*api.User, error) {
// panic("mock out the GetCodespaceBillableOwner method")
// },
// GetCodespaceRepoSuggestionsFunc: func(ctx context.Context, partialSearch string, params api.RepoSearchParameters) ([]string, error) {
// panic("mock out the GetCodespaceRepoSuggestions method")
// },
// GetCodespaceRepositoryContentsFunc: func(ctx context.Context, codespace *api.Codespace, path string) ([]byte, error) {
// panic("mock out the GetCodespaceRepositoryContents method")
// },
// GetCodespacesMachinesFunc: func(ctx context.Context, repoID int, branch string, location string, devcontainerPath string) ([]*api.Machine, error) {
// panic("mock out the GetCodespacesMachines method")
// },
// GetOrgMemberCodespaceFunc: func(ctx context.Context, orgName string, userName string, codespaceName string) (*api.Codespace, error) {
// panic("mock out the GetOrgMemberCodespace method")
// },
// GetRepositoryFunc: func(ctx context.Context, nwo string) (*api.Repository, error) {
// panic("mock out the GetRepository method")
// },
// ListCodespacesFunc: func(ctx context.Context, opts api.ListCodespacesOptions) ([]*api.Codespace, error) {
// panic("mock out the ListCodespaces method")
// },
// ListDevContainersFunc: func(ctx context.Context, repoID int, branch string, limit int) ([]api.DevContainerEntry, error) {
// panic("mock out the ListDevContainers method")
// },
// StartCodespaceFunc: func(ctx context.Context, name string) error {
// panic("mock out the StartCodespace method")
// },
// StopCodespaceFunc: func(ctx context.Context, name string, orgName string, userName string) error {
// panic("mock out the StopCodespace method")
// },
// }
// // make and configure a mocked apiClient
// mockedapiClient := &apiClientMock{
// CreateCodespaceFunc: func(ctx context.Context, params *api.CreateCodespaceParams) (*api.Codespace, error) {
// panic("mock out the CreateCodespace method")
// },
// DeleteCodespaceFunc: func(ctx context.Context, name string, orgName string, userName string) error {
// panic("mock out the DeleteCodespace method")
// },
// EditCodespaceFunc: func(ctx context.Context, codespaceName string, params *api.EditCodespaceParams) (*api.Codespace, error) {
// panic("mock out the EditCodespace method")
// },
// GetCodespaceFunc: func(ctx context.Context, name string, includeConnection bool) (*api.Codespace, error) {
// panic("mock out the GetCodespace method")
// },
// GetCodespaceBillableOwnerFunc: func(ctx context.Context, nwo string) (*api.User, error) {
// panic("mock out the GetCodespaceBillableOwner method")
// },
// GetCodespaceRepoSuggestionsFunc: func(ctx context.Context, partialSearch string, params api.RepoSearchParameters) ([]string, error) {
// panic("mock out the GetCodespaceRepoSuggestions method")
// },
// GetCodespaceRepositoryContentsFunc: func(ctx context.Context, codespace *api.Codespace, path string) ([]byte, error) {
// panic("mock out the GetCodespaceRepositoryContents method")
// },
// GetCodespacesMachinesFunc: func(ctx context.Context, repoID int, branch string, location string, devcontainerPath string) ([]*api.Machine, error) {
// panic("mock out the GetCodespacesMachines method")
// },
// GetOrgMemberCodespaceFunc: func(ctx context.Context, orgName string, userName string, codespaceName string) (*api.Codespace, error) {
// panic("mock out the GetOrgMemberCodespace method")
// },
// GetRepositoryFunc: func(ctx context.Context, nwo string) (*api.Repository, error) {
// panic("mock out the GetRepository method")
// },
// ListCodespacesFunc: func(ctx context.Context, opts api.ListCodespacesOptions) ([]*api.Codespace, error) {
// panic("mock out the ListCodespaces method")
// },
// ListDevContainersFunc: func(ctx context.Context, repoID int, branch string, limit int) ([]api.DevContainerEntry, error) {
// panic("mock out the ListDevContainers method")
// },
// StartCodespaceFunc: func(ctx context.Context, name string) error {
// panic("mock out the StartCodespace method")
// },
// StopCodespaceFunc: func(ctx context.Context, name string, orgName string, userName string) error {
// panic("mock out the StopCodespace method")
// },
// }
//
// // use mockedapiClient in code that requires apiClient
// // and then make assertions.
// // use mockedapiClient in code that requires apiClient
// // and then make assertions.
//
// }
// }
type apiClientMock struct {
// CreateCodespaceFunc mocks the CreateCodespace method.
CreateCodespaceFunc func(ctx context.Context, params *api.CreateCodespaceParams) (*api.Codespace, error)
@ -274,7 +274,8 @@ func (mock *apiClientMock) CreateCodespace(ctx context.Context, params *api.Crea
// CreateCodespaceCalls gets all the calls that were made to CreateCodespace.
// Check the length with:
// len(mockedapiClient.CreateCodespaceCalls())
//
// len(mockedapiClient.CreateCodespaceCalls())
func (mock *apiClientMock) CreateCodespaceCalls() []struct {
Ctx context.Context
Params *api.CreateCodespaceParams
@ -313,7 +314,8 @@ func (mock *apiClientMock) DeleteCodespace(ctx context.Context, name string, org
// DeleteCodespaceCalls gets all the calls that were made to DeleteCodespace.
// Check the length with:
// len(mockedapiClient.DeleteCodespaceCalls())
//
// len(mockedapiClient.DeleteCodespaceCalls())
func (mock *apiClientMock) DeleteCodespaceCalls() []struct {
Ctx context.Context
Name string
@ -354,7 +356,8 @@ func (mock *apiClientMock) EditCodespace(ctx context.Context, codespaceName stri
// EditCodespaceCalls gets all the calls that were made to EditCodespace.
// Check the length with:
// len(mockedapiClient.EditCodespaceCalls())
//
// len(mockedapiClient.EditCodespaceCalls())
func (mock *apiClientMock) EditCodespaceCalls() []struct {
Ctx context.Context
CodespaceName string
@ -393,7 +396,8 @@ func (mock *apiClientMock) GetCodespace(ctx context.Context, name string, includ
// GetCodespaceCalls gets all the calls that were made to GetCodespace.
// Check the length with:
// len(mockedapiClient.GetCodespaceCalls())
//
// len(mockedapiClient.GetCodespaceCalls())
func (mock *apiClientMock) GetCodespaceCalls() []struct {
Ctx context.Context
Name string
@ -430,7 +434,8 @@ func (mock *apiClientMock) GetCodespaceBillableOwner(ctx context.Context, nwo st
// GetCodespaceBillableOwnerCalls gets all the calls that were made to GetCodespaceBillableOwner.
// Check the length with:
// len(mockedapiClient.GetCodespaceBillableOwnerCalls())
//
// len(mockedapiClient.GetCodespaceBillableOwnerCalls())
func (mock *apiClientMock) GetCodespaceBillableOwnerCalls() []struct {
Ctx context.Context
Nwo string
@ -467,7 +472,8 @@ func (mock *apiClientMock) GetCodespaceRepoSuggestions(ctx context.Context, part
// GetCodespaceRepoSuggestionsCalls gets all the calls that were made to GetCodespaceRepoSuggestions.
// Check the length with:
// len(mockedapiClient.GetCodespaceRepoSuggestionsCalls())
//
// len(mockedapiClient.GetCodespaceRepoSuggestionsCalls())
func (mock *apiClientMock) GetCodespaceRepoSuggestionsCalls() []struct {
Ctx context.Context
PartialSearch string
@ -506,7 +512,8 @@ func (mock *apiClientMock) GetCodespaceRepositoryContents(ctx context.Context, c
// GetCodespaceRepositoryContentsCalls gets all the calls that were made to GetCodespaceRepositoryContents.
// Check the length with:
// len(mockedapiClient.GetCodespaceRepositoryContentsCalls())
//
// len(mockedapiClient.GetCodespaceRepositoryContentsCalls())
func (mock *apiClientMock) GetCodespaceRepositoryContentsCalls() []struct {
Ctx context.Context
Codespace *api.Codespace
@ -549,7 +556,8 @@ func (mock *apiClientMock) GetCodespacesMachines(ctx context.Context, repoID int
// GetCodespacesMachinesCalls gets all the calls that were made to GetCodespacesMachines.
// Check the length with:
// len(mockedapiClient.GetCodespacesMachinesCalls())
//
// len(mockedapiClient.GetCodespacesMachinesCalls())
func (mock *apiClientMock) GetCodespacesMachinesCalls() []struct {
Ctx context.Context
RepoID int
@ -594,7 +602,8 @@ func (mock *apiClientMock) GetOrgMemberCodespace(ctx context.Context, orgName st
// GetOrgMemberCodespaceCalls gets all the calls that were made to GetOrgMemberCodespace.
// Check the length with:
// len(mockedapiClient.GetOrgMemberCodespaceCalls())
//
// len(mockedapiClient.GetOrgMemberCodespaceCalls())
func (mock *apiClientMock) GetOrgMemberCodespaceCalls() []struct {
Ctx context.Context
OrgName string
@ -633,7 +642,8 @@ func (mock *apiClientMock) GetRepository(ctx context.Context, nwo string) (*api.
// GetRepositoryCalls gets all the calls that were made to GetRepository.
// Check the length with:
// len(mockedapiClient.GetRepositoryCalls())
//
// len(mockedapiClient.GetRepositoryCalls())
func (mock *apiClientMock) GetRepositoryCalls() []struct {
Ctx context.Context
Nwo string
@ -668,7 +678,8 @@ func (mock *apiClientMock) ListCodespaces(ctx context.Context, opts api.ListCode
// ListCodespacesCalls gets all the calls that were made to ListCodespaces.
// Check the length with:
// len(mockedapiClient.ListCodespacesCalls())
//
// len(mockedapiClient.ListCodespacesCalls())
func (mock *apiClientMock) ListCodespacesCalls() []struct {
Ctx context.Context
Opts api.ListCodespacesOptions
@ -707,7 +718,8 @@ func (mock *apiClientMock) ListDevContainers(ctx context.Context, repoID int, br
// ListDevContainersCalls gets all the calls that were made to ListDevContainers.
// Check the length with:
// len(mockedapiClient.ListDevContainersCalls())
//
// len(mockedapiClient.ListDevContainersCalls())
func (mock *apiClientMock) ListDevContainersCalls() []struct {
Ctx context.Context
RepoID int
@ -746,7 +758,8 @@ func (mock *apiClientMock) StartCodespace(ctx context.Context, name string) erro
// StartCodespaceCalls gets all the calls that were made to StartCodespace.
// Check the length with:
// len(mockedapiClient.StartCodespaceCalls())
//
// len(mockedapiClient.StartCodespaceCalls())
func (mock *apiClientMock) StartCodespaceCalls() []struct {
Ctx context.Context
Name string
@ -785,7 +798,8 @@ func (mock *apiClientMock) StopCodespace(ctx context.Context, name string, orgNa
// StopCodespaceCalls gets all the calls that were made to StopCodespace.
// Check the length with:
// len(mockedapiClient.StopCodespaceCalls())
//
// len(mockedapiClient.StopCodespaceCalls())
func (mock *apiClientMock) StopCodespaceCalls() []struct {
Ctx context.Context
Name string

View file

@ -9,19 +9,19 @@ import (
// prompterMock is a mock implementation of prompter.
//
// func TestSomethingThatUsesprompter(t *testing.T) {
// func TestSomethingThatUsesprompter(t *testing.T) {
//
// // make and configure a mocked prompter
// mockedprompter := &prompterMock{
// ConfirmFunc: func(message string) (bool, error) {
// panic("mock out the Confirm method")
// },
// }
// // make and configure a mocked prompter
// mockedprompter := &prompterMock{
// ConfirmFunc: func(message string) (bool, error) {
// panic("mock out the Confirm method")
// },
// }
//
// // use mockedprompter in code that requires prompter
// // and then make assertions.
// // use mockedprompter in code that requires prompter
// // and then make assertions.
//
// }
// }
type prompterMock struct {
// ConfirmFunc mocks the Confirm method.
ConfirmFunc func(message string) (bool, error)
@ -55,7 +55,8 @@ func (mock *prompterMock) Confirm(message string) (bool, error) {
// ConfirmCalls gets all the calls that were made to Confirm.
// Check the length with:
// len(mockedprompter.ConfirmCalls())
//
// len(mockedprompter.ConfirmCalls())
func (mock *prompterMock) ConfirmCalls() []struct {
Message string
} {

View file

@ -13,40 +13,40 @@ var _ Extension = &ExtensionMock{}
// ExtensionMock is a mock implementation of Extension.
//
// func TestSomethingThatUsesExtension(t *testing.T) {
// func TestSomethingThatUsesExtension(t *testing.T) {
//
// // make and configure a mocked Extension
// mockedExtension := &ExtensionMock{
// CurrentVersionFunc: func() string {
// panic("mock out the CurrentVersion method")
// },
// IsBinaryFunc: func() bool {
// panic("mock out the IsBinary method")
// },
// IsLocalFunc: func() bool {
// panic("mock out the IsLocal method")
// },
// IsPinnedFunc: func() bool {
// panic("mock out the IsPinned method")
// },
// NameFunc: func() string {
// panic("mock out the Name method")
// },
// PathFunc: func() string {
// panic("mock out the Path method")
// },
// URLFunc: func() string {
// panic("mock out the URL method")
// },
// UpdateAvailableFunc: func() bool {
// panic("mock out the UpdateAvailable method")
// },
// }
// // make and configure a mocked Extension
// mockedExtension := &ExtensionMock{
// CurrentVersionFunc: func() string {
// panic("mock out the CurrentVersion method")
// },
// IsBinaryFunc: func() bool {
// panic("mock out the IsBinary method")
// },
// IsLocalFunc: func() bool {
// panic("mock out the IsLocal method")
// },
// IsPinnedFunc: func() bool {
// panic("mock out the IsPinned method")
// },
// NameFunc: func() string {
// panic("mock out the Name method")
// },
// PathFunc: func() string {
// panic("mock out the Path method")
// },
// URLFunc: func() string {
// panic("mock out the URL method")
// },
// UpdateAvailableFunc: func() bool {
// panic("mock out the UpdateAvailable method")
// },
// }
//
// // use mockedExtension in code that requires Extension
// // and then make assertions.
// // use mockedExtension in code that requires Extension
// // and then make assertions.
//
// }
// }
type ExtensionMock struct {
// CurrentVersionFunc mocks the CurrentVersion method.
CurrentVersionFunc func() string
@ -124,7 +124,8 @@ func (mock *ExtensionMock) CurrentVersion() string {
// CurrentVersionCalls gets all the calls that were made to CurrentVersion.
// Check the length with:
// len(mockedExtension.CurrentVersionCalls())
//
// len(mockedExtension.CurrentVersionCalls())
func (mock *ExtensionMock) CurrentVersionCalls() []struct {
} {
var calls []struct {
@ -150,7 +151,8 @@ func (mock *ExtensionMock) IsBinary() bool {
// IsBinaryCalls gets all the calls that were made to IsBinary.
// Check the length with:
// len(mockedExtension.IsBinaryCalls())
//
// len(mockedExtension.IsBinaryCalls())
func (mock *ExtensionMock) IsBinaryCalls() []struct {
} {
var calls []struct {
@ -176,7 +178,8 @@ func (mock *ExtensionMock) IsLocal() bool {
// IsLocalCalls gets all the calls that were made to IsLocal.
// Check the length with:
// len(mockedExtension.IsLocalCalls())
//
// len(mockedExtension.IsLocalCalls())
func (mock *ExtensionMock) IsLocalCalls() []struct {
} {
var calls []struct {
@ -202,7 +205,8 @@ func (mock *ExtensionMock) IsPinned() bool {
// IsPinnedCalls gets all the calls that were made to IsPinned.
// Check the length with:
// len(mockedExtension.IsPinnedCalls())
//
// len(mockedExtension.IsPinnedCalls())
func (mock *ExtensionMock) IsPinnedCalls() []struct {
} {
var calls []struct {
@ -228,7 +232,8 @@ func (mock *ExtensionMock) Name() string {
// NameCalls gets all the calls that were made to Name.
// Check the length with:
// len(mockedExtension.NameCalls())
//
// len(mockedExtension.NameCalls())
func (mock *ExtensionMock) NameCalls() []struct {
} {
var calls []struct {
@ -254,7 +259,8 @@ func (mock *ExtensionMock) Path() string {
// PathCalls gets all the calls that were made to Path.
// Check the length with:
// len(mockedExtension.PathCalls())
//
// len(mockedExtension.PathCalls())
func (mock *ExtensionMock) PathCalls() []struct {
} {
var calls []struct {
@ -280,7 +286,8 @@ func (mock *ExtensionMock) URL() string {
// URLCalls gets all the calls that were made to URL.
// Check the length with:
// len(mockedExtension.URLCalls())
//
// len(mockedExtension.URLCalls())
func (mock *ExtensionMock) URLCalls() []struct {
} {
var calls []struct {
@ -306,7 +313,8 @@ func (mock *ExtensionMock) UpdateAvailable() bool {
// UpdateAvailableCalls gets all the calls that were made to UpdateAvailable.
// Check the length with:
// len(mockedExtension.UpdateAvailableCalls())
//
// len(mockedExtension.UpdateAvailableCalls())
func (mock *ExtensionMock) UpdateAvailableCalls() []struct {
} {
var calls []struct {

View file

@ -15,40 +15,40 @@ var _ ExtensionManager = &ExtensionManagerMock{}
// ExtensionManagerMock is a mock implementation of ExtensionManager.
//
// func TestSomethingThatUsesExtensionManager(t *testing.T) {
// func TestSomethingThatUsesExtensionManager(t *testing.T) {
//
// // make and configure a mocked ExtensionManager
// mockedExtensionManager := &ExtensionManagerMock{
// CreateFunc: func(name string, tmplType ExtTemplateType) error {
// panic("mock out the Create method")
// },
// DispatchFunc: func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error) {
// panic("mock out the Dispatch method")
// },
// EnableDryRunModeFunc: func() {
// panic("mock out the EnableDryRunMode method")
// },
// InstallFunc: func(interfaceMoqParam ghrepo.Interface, s string) error {
// panic("mock out the Install method")
// },
// InstallLocalFunc: func(dir string) error {
// panic("mock out the InstallLocal method")
// },
// ListFunc: func() []Extension {
// panic("mock out the List method")
// },
// RemoveFunc: func(name string) error {
// panic("mock out the Remove method")
// },
// UpgradeFunc: func(name string, force bool) error {
// panic("mock out the Upgrade method")
// },
// }
// // make and configure a mocked ExtensionManager
// mockedExtensionManager := &ExtensionManagerMock{
// CreateFunc: func(name string, tmplType ExtTemplateType) error {
// panic("mock out the Create method")
// },
// DispatchFunc: func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error) {
// panic("mock out the Dispatch method")
// },
// EnableDryRunModeFunc: func() {
// panic("mock out the EnableDryRunMode method")
// },
// InstallFunc: func(interfaceMoqParam ghrepo.Interface, s string) error {
// panic("mock out the Install method")
// },
// InstallLocalFunc: func(dir string) error {
// panic("mock out the InstallLocal method")
// },
// ListFunc: func() []Extension {
// panic("mock out the List method")
// },
// RemoveFunc: func(name string) error {
// panic("mock out the Remove method")
// },
// UpgradeFunc: func(name string, force bool) error {
// panic("mock out the Upgrade method")
// },
// }
//
// // use mockedExtensionManager in code that requires ExtensionManager
// // and then make assertions.
// // use mockedExtensionManager in code that requires ExtensionManager
// // and then make assertions.
//
// }
// }
type ExtensionManagerMock struct {
// CreateFunc mocks the Create method.
CreateFunc func(name string, tmplType ExtTemplateType) error
@ -155,7 +155,8 @@ func (mock *ExtensionManagerMock) Create(name string, tmplType ExtTemplateType)
// CreateCalls gets all the calls that were made to Create.
// Check the length with:
// len(mockedExtensionManager.CreateCalls())
//
// len(mockedExtensionManager.CreateCalls())
func (mock *ExtensionManagerMock) CreateCalls() []struct {
Name string
TmplType ExtTemplateType
@ -194,7 +195,8 @@ func (mock *ExtensionManagerMock) Dispatch(args []string, stdin io.Reader, stdou
// DispatchCalls gets all the calls that were made to Dispatch.
// Check the length with:
// len(mockedExtensionManager.DispatchCalls())
//
// len(mockedExtensionManager.DispatchCalls())
func (mock *ExtensionManagerMock) DispatchCalls() []struct {
Args []string
Stdin io.Reader
@ -228,7 +230,8 @@ func (mock *ExtensionManagerMock) EnableDryRunMode() {
// EnableDryRunModeCalls gets all the calls that were made to EnableDryRunMode.
// Check the length with:
// len(mockedExtensionManager.EnableDryRunModeCalls())
//
// len(mockedExtensionManager.EnableDryRunModeCalls())
func (mock *ExtensionManagerMock) EnableDryRunModeCalls() []struct {
} {
var calls []struct {
@ -259,7 +262,8 @@ func (mock *ExtensionManagerMock) Install(interfaceMoqParam ghrepo.Interface, s
// InstallCalls gets all the calls that were made to Install.
// Check the length with:
// len(mockedExtensionManager.InstallCalls())
//
// len(mockedExtensionManager.InstallCalls())
func (mock *ExtensionManagerMock) InstallCalls() []struct {
InterfaceMoqParam ghrepo.Interface
S string
@ -292,7 +296,8 @@ func (mock *ExtensionManagerMock) InstallLocal(dir string) error {
// InstallLocalCalls gets all the calls that were made to InstallLocal.
// Check the length with:
// len(mockedExtensionManager.InstallLocalCalls())
//
// len(mockedExtensionManager.InstallLocalCalls())
func (mock *ExtensionManagerMock) InstallLocalCalls() []struct {
Dir string
} {
@ -320,7 +325,8 @@ func (mock *ExtensionManagerMock) List() []Extension {
// ListCalls gets all the calls that were made to List.
// Check the length with:
// len(mockedExtensionManager.ListCalls())
//
// len(mockedExtensionManager.ListCalls())
func (mock *ExtensionManagerMock) ListCalls() []struct {
} {
var calls []struct {
@ -349,7 +355,8 @@ func (mock *ExtensionManagerMock) Remove(name string) error {
// RemoveCalls gets all the calls that were made to Remove.
// Check the length with:
// len(mockedExtensionManager.RemoveCalls())
//
// len(mockedExtensionManager.RemoveCalls())
func (mock *ExtensionManagerMock) RemoveCalls() []struct {
Name string
} {
@ -382,7 +389,8 @@ func (mock *ExtensionManagerMock) Upgrade(name string, force bool) error {
// UpgradeCalls gets all the calls that were made to Upgrade.
// Check the length with:
// len(mockedExtensionManager.UpgradeCalls())
//
// len(mockedExtensionManager.UpgradeCalls())
func (mock *ExtensionManagerMock) UpgradeCalls() []struct {
Name string
Force bool

View file

@ -13,25 +13,25 @@ var _ Searcher = &SearcherMock{}
// SearcherMock is a mock implementation of Searcher.
//
// func TestSomethingThatUsesSearcher(t *testing.T) {
// func TestSomethingThatUsesSearcher(t *testing.T) {
//
// // make and configure a mocked Searcher
// mockedSearcher := &SearcherMock{
// IssuesFunc: func(query Query) (IssuesResult, error) {
// panic("mock out the Issues method")
// },
// RepositoriesFunc: func(query Query) (RepositoriesResult, error) {
// panic("mock out the Repositories method")
// },
// URLFunc: func(query Query) string {
// panic("mock out the URL method")
// },
// }
// // make and configure a mocked Searcher
// mockedSearcher := &SearcherMock{
// IssuesFunc: func(query Query) (IssuesResult, error) {
// panic("mock out the Issues method")
// },
// RepositoriesFunc: func(query Query) (RepositoriesResult, error) {
// panic("mock out the Repositories method")
// },
// URLFunc: func(query Query) string {
// panic("mock out the URL method")
// },
// }
//
// // use mockedSearcher in code that requires Searcher
// // and then make assertions.
// // use mockedSearcher in code that requires Searcher
// // and then make assertions.
//
// }
// }
type SearcherMock struct {
// IssuesFunc mocks the Issues method.
IssuesFunc func(query Query) (IssuesResult, error)
@ -83,7 +83,8 @@ func (mock *SearcherMock) Issues(query Query) (IssuesResult, error) {
// IssuesCalls gets all the calls that were made to Issues.
// Check the length with:
// len(mockedSearcher.IssuesCalls())
//
// len(mockedSearcher.IssuesCalls())
func (mock *SearcherMock) IssuesCalls() []struct {
Query Query
} {
@ -114,7 +115,8 @@ func (mock *SearcherMock) Repositories(query Query) (RepositoriesResult, error)
// RepositoriesCalls gets all the calls that were made to Repositories.
// Check the length with:
// len(mockedSearcher.RepositoriesCalls())
//
// len(mockedSearcher.RepositoriesCalls())
func (mock *SearcherMock) RepositoriesCalls() []struct {
Query Query
} {
@ -145,7 +147,8 @@ func (mock *SearcherMock) URL(query Query) string {
// URLCalls gets all the calls that were made to URL.
// Check the length with:
// len(mockedSearcher.URLCalls())
//
// len(mockedSearcher.URLCalls())
func (mock *SearcherMock) URLCalls() []struct {
Query Query
} {