Documentation ¶
Index ¶
- Variables
- type Ambassador
- type Clock
- type FakeFile
- type File
- type MockAmbassador
- func (m *MockAmbassador) Environ() []string
- func (m *MockAmbassador) LookPath(file string) (string, error)
- func (m *MockAmbassador) Remove(name string) error
- func (m *MockAmbassador) RunCmd(cmd *exec.Cmd) ([]byte, int, error)
- func (m *MockAmbassador) TempFile(dir, pattern string) (file File, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultAmbassador = &ambassador{}
)
Functions ¶
This section is empty.
Types ¶
type Ambassador ¶
type Ambassador interface { Environ() []string LookPath(string) (string, error) RunCmd(cmd *exec.Cmd) ([]byte, int, error) TempFile(dir, pattern string) (File, error) Remove(name string) error }
Ambassador the ambassador to the outside "world". Wraps methods that modify global state and hence make the code that use them very hard to test.
type Clock ¶
Clock wraps the Now method. Introduced to allow replacing the global state with fixed clocks to facilitate testing. Now returns the current time.
func NewFixedClock ¶
func NewSystemClock ¶
func NewSystemClock() Clock
type FakeFile ¶
type FakeFile struct {
// contains filtered or unexported fields
}
func NewFakeFile ¶
NewFakeFile constructs a new FakeFile with the given name and content.
type MockAmbassador ¶
func NewMockAmbassador ¶
func NewMockAmbassador() *MockAmbassador
func (*MockAmbassador) Environ ¶
func (m *MockAmbassador) Environ() []string
func (*MockAmbassador) Remove ¶
func (m *MockAmbassador) Remove(name string) error
Click to show internal directories.
Click to hide internal directories.