Documentation
¶
Index ¶
- func EmptyStringValidator(value string) error
- type Prompter
- type PrompterMock
- func (mock *PrompterMock) Confirm(s string) (bool, error)
- func (mock *PrompterMock) ConfirmCalls() []struct{ ... }
- func (mock *PrompterMock) Input(s1 string, s2 string, askOpts ...survey.AskOpt) (string, error)
- func (mock *PrompterMock) InputCalls() []struct{ ... }
- func (mock *PrompterMock) InputWithHelp(s1 string, s2 string, s3 string, askOpts ...survey.AskOpt) (string, error)
- func (mock *PrompterMock) InputWithHelpCalls() []struct{ ... }
- func (mock *PrompterMock) Select(s string, strings []string) (string, error)
- func (mock *PrompterMock) SelectCalls() []struct{ ... }
- func (mock *PrompterMock) SelectWithHelp(s1 string, s2 string, strings []string) (string, error)
- func (mock *PrompterMock) SelectWithHelpCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmptyStringValidator ¶
Types ¶
type Prompter ¶
type Prompter interface { Select(string, []string) (string, error) SelectWithHelp(string, string, []string) (string, error) Input(string, string, ...survey.AskOpt) (string, error) InputWithHelp(string, string, string, ...survey.AskOpt) (string, error) Confirm(string) (bool, error) }
func NewPrompter ¶
func NewPrompter() Prompter
type PrompterMock ¶
type PrompterMock struct { // ConfirmFunc mocks the Confirm method. ConfirmFunc func(s string) (bool, error) // InputFunc mocks the Input method. InputFunc func(s1 string, s2 string, askOpts ...survey.AskOpt) (string, error) // InputWithHelpFunc mocks the InputWithHelp method. InputWithHelpFunc func(s1 string, s2 string, s3 string, askOpts ...survey.AskOpt) (string, error) // SelectFunc mocks the Select method. SelectFunc func(s string, strings []string) (string, error) // SelectWithHelpFunc mocks the SelectWithHelp method. SelectWithHelpFunc func(s1 string, s2 string, strings []string) (string, error) // contains filtered or unexported fields }
PrompterMock is a mock implementation of Prompter.
func TestSomethingThatUsesPrompter(t *testing.T) { // make and configure a mocked Prompter mockedPrompter := &PrompterMock{ ConfirmFunc: func(s string) (bool, error) { panic("mock out the Confirm method") }, InputFunc: func(s1 string, s2 string, askOpts ...survey.AskOpt) (string, error) { panic("mock out the Input method") }, InputWithHelpFunc: func(s1 string, s2 string, s3 string, askOpts ...survey.AskOpt) (string, error) { panic("mock out the InputWithHelp method") }, SelectFunc: func(s string, strings []string) (string, error) { panic("mock out the Select method") }, SelectWithHelpFunc: func(s1 string, s2 string, strings []string) (string, error) { panic("mock out the SelectWithHelp method") }, } // use mockedPrompter in code that requires Prompter // and then make assertions. }
func (*PrompterMock) Confirm ¶
func (mock *PrompterMock) Confirm(s string) (bool, error)
Confirm calls ConfirmFunc.
func (*PrompterMock) ConfirmCalls ¶
func (mock *PrompterMock) ConfirmCalls() []struct { S string }
ConfirmCalls gets all the calls that were made to Confirm. Check the length with:
len(mockedPrompter.ConfirmCalls())
func (*PrompterMock) Input ¶
func (mock *PrompterMock) Input(s1 string, s2 string, askOpts ...survey.AskOpt) (string, error)
Input calls InputFunc.
func (*PrompterMock) InputCalls ¶
func (mock *PrompterMock) InputCalls() []struct { S1 string S2 string AskOpts []survey.AskOpt }
InputCalls gets all the calls that were made to Input. Check the length with:
len(mockedPrompter.InputCalls())
func (*PrompterMock) InputWithHelp ¶
func (mock *PrompterMock) InputWithHelp(s1 string, s2 string, s3 string, askOpts ...survey.AskOpt) (string, error)
InputWithHelp calls InputWithHelpFunc.
func (*PrompterMock) InputWithHelpCalls ¶
func (mock *PrompterMock) InputWithHelpCalls() []struct { S1 string S2 string S3 string AskOpts []survey.AskOpt }
InputWithHelpCalls gets all the calls that were made to InputWithHelp. Check the length with:
len(mockedPrompter.InputWithHelpCalls())
func (*PrompterMock) Select ¶
func (mock *PrompterMock) Select(s string, strings []string) (string, error)
Select calls SelectFunc.
func (*PrompterMock) SelectCalls ¶
func (mock *PrompterMock) SelectCalls() []struct { S string Strings []string }
SelectCalls gets all the calls that were made to Select. Check the length with:
len(mockedPrompter.SelectCalls())
func (*PrompterMock) SelectWithHelp ¶
SelectWithHelp calls SelectWithHelpFunc.
func (*PrompterMock) SelectWithHelpCalls ¶
func (mock *PrompterMock) SelectWithHelpCalls() []struct { S1 string S2 string Strings []string }
SelectWithHelpCalls gets all the calls that were made to SelectWithHelp. Check the length with:
len(mockedPrompter.SelectWithHelpCalls())
Click to show internal directories.
Click to hide internal directories.