Documentation
¶
Index ¶
- type BlamerMock
- type RendererMock
- func (mock *RendererMock) ChangedFiles(ref string, staged bool) ([]diff.FileEntry, error)
- func (mock *RendererMock) ChangedFilesCalls() []struct{ ... }
- func (mock *RendererMock) FileDiff(ref string, file string, staged bool) ([]diff.DiffLine, error)
- func (mock *RendererMock) FileDiffCalls() []struct{ ... }
- type SyntaxHighlighterMock
- func (mock *SyntaxHighlighterMock) HighlightLines(filename string, lines []diff.DiffLine) []string
- func (mock *SyntaxHighlighterMock) HighlightLinesCalls() []struct{ ... }
- func (mock *SyntaxHighlighterMock) SetStyle(styleName string) bool
- func (mock *SyntaxHighlighterMock) SetStyleCalls() []struct{ ... }
- func (mock *SyntaxHighlighterMock) StyleName() string
- func (mock *SyntaxHighlighterMock) StyleNameCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlamerMock ¶
type BlamerMock struct {
// FileBlameFunc mocks the FileBlame method.
FileBlameFunc func(ref string, file string, staged bool) (map[int]diff.BlameLine, error)
// contains filtered or unexported fields
}
BlamerMock is a mock implementation of ui.Blamer.
func TestSomethingThatUsesBlamer(t *testing.T) {
// make and configure a mocked ui.Blamer
mockedBlamer := &BlamerMock{
FileBlameFunc: func(ref string, file string, staged bool) (map[int]diff.BlameLine, error) {
panic("mock out the FileBlame method")
},
}
// use mockedBlamer in code that requires ui.Blamer
// and then make assertions.
}
func (*BlamerMock) FileBlame ¶
func (mock *BlamerMock) FileBlame(ref string, file string, staged bool) (map[int]diff.BlameLine, error)
FileBlame calls FileBlameFunc.
func (*BlamerMock) FileBlameCalls ¶
func (mock *BlamerMock) FileBlameCalls() []struct { Ref string File string Staged bool }
FileBlameCalls gets all the calls that were made to FileBlame. Check the length with:
len(mockedBlamer.FileBlameCalls())
type RendererMock ¶
type RendererMock struct {
// ChangedFilesFunc mocks the ChangedFiles method.
ChangedFilesFunc func(ref string, staged bool) ([]diff.FileEntry, 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) ([]diff.FileEntry, 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 ¶
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
// SetStyleFunc mocks the SetStyle method.
SetStyleFunc func(styleName string) bool
// StyleNameFunc mocks the StyleName method.
StyleNameFunc func() 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")
},
SetStyleFunc: func(styleName string) bool {
panic("mock out the SetStyle method")
},
StyleNameFunc: func() string {
panic("mock out the StyleName 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())
func (*SyntaxHighlighterMock) SetStyle ¶ added in v0.15.0
func (mock *SyntaxHighlighterMock) SetStyle(styleName string) bool
SetStyle calls SetStyleFunc.
func (*SyntaxHighlighterMock) SetStyleCalls ¶ added in v0.15.0
func (mock *SyntaxHighlighterMock) SetStyleCalls() []struct { StyleName string }
SetStyleCalls gets all the calls that were made to SetStyle. Check the length with:
len(mockedSyntaxHighlighter.SetStyleCalls())
func (*SyntaxHighlighterMock) StyleName ¶ added in v0.15.0
func (mock *SyntaxHighlighterMock) StyleName() string
StyleName calls StyleNameFunc.
func (*SyntaxHighlighterMock) StyleNameCalls ¶ added in v0.15.0
func (mock *SyntaxHighlighterMock) StyleNameCalls() []struct { }
StyleNameCalls gets all the calls that were made to StyleName. Check the length with:
len(mockedSyntaxHighlighter.StyleNameCalls())