Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RendererMock ¶
type RendererMock struct {
// ChangedFilesFunc mocks the ChangedFiles method.
ChangedFilesFunc func(ref string, staged bool) ([]string, error)
// FileDiffFunc mocks the FileDiff method.
FileDiffFunc func(ref string, file string, staged bool) ([]diff.DiffLine, error)
// contains filtered or unexported fields
}
RendererMock is a mock implementation of ui.Renderer.
func TestSomethingThatUsesRenderer(t *testing.T) {
// make and configure a mocked ui.Renderer
mockedRenderer := &RendererMock{
ChangedFilesFunc: func(ref string, staged bool) ([]string, error) {
panic("mock out the ChangedFiles method")
},
FileDiffFunc: func(ref string, file string, staged bool) ([]diff.DiffLine, error) {
panic("mock out the FileDiff method")
},
}
// use mockedRenderer in code that requires ui.Renderer
// and then make assertions.
}
func (*RendererMock) ChangedFiles ¶
func (mock *RendererMock) ChangedFiles(ref string, staged bool) ([]string, error)
ChangedFiles calls ChangedFilesFunc.
func (*RendererMock) ChangedFilesCalls ¶
func (mock *RendererMock) ChangedFilesCalls() []struct { Ref string Staged bool }
ChangedFilesCalls gets all the calls that were made to ChangedFiles. Check the length with:
len(mockedRenderer.ChangedFilesCalls())
func (*RendererMock) FileDiffCalls ¶
func (mock *RendererMock) FileDiffCalls() []struct { Ref string File string Staged bool }
FileDiffCalls gets all the calls that were made to FileDiff. Check the length with:
len(mockedRenderer.FileDiffCalls())
type SyntaxHighlighterMock ¶
type SyntaxHighlighterMock struct {
// HighlightLinesFunc mocks the HighlightLines method.
HighlightLinesFunc func(filename string, lines []diff.DiffLine) []string
// contains filtered or unexported fields
}
SyntaxHighlighterMock is a mock implementation of ui.SyntaxHighlighter.
func TestSomethingThatUsesSyntaxHighlighter(t *testing.T) {
// make and configure a mocked ui.SyntaxHighlighter
mockedSyntaxHighlighter := &SyntaxHighlighterMock{
HighlightLinesFunc: func(filename string, lines []diff.DiffLine) []string {
panic("mock out the HighlightLines method")
},
}
// use mockedSyntaxHighlighter in code that requires ui.SyntaxHighlighter
// and then make assertions.
}
func (*SyntaxHighlighterMock) HighlightLines ¶
func (mock *SyntaxHighlighterMock) HighlightLines(filename string, lines []diff.DiffLine) []string
HighlightLines calls HighlightLinesFunc.
func (*SyntaxHighlighterMock) HighlightLinesCalls ¶
func (mock *SyntaxHighlighterMock) HighlightLinesCalls() []struct { Filename string Lines []diff.DiffLine }
HighlightLinesCalls gets all the calls that were made to HighlightLines. Check the length with:
len(mockedSyntaxHighlighter.HighlightLinesCalls())
Click to show internal directories.
Click to hide internal directories.