Documentation
¶
Overview ¶
Package exectest provides test doubles for the exec package: a recording MockRunner and a FakeBin helper for tests that need the real exec path.
Index ¶
- func FakeBin(t *testing.T, name, script string)
- type Call
- type MockRunner
- func (m *MockRunner) QueueResponse(stdout, stderr string, err error)
- func (m *MockRunner) Run(name string, args ...string) (string, string, error)
- func (m *MockRunner) RunDir(dir string, env []string, name string, args ...string) (string, string, error)
- func (m *MockRunner) RunEnv(env []string, name string, args ...string) (string, string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Call ¶
type Call struct {
Name string
Args []string
Env []string // nil for Run calls; set for RunEnv/RunDir calls
Dir string // empty for Run/RunEnv calls; set for RunDir calls
}
Call records a single invocation of MockRunner.Run, RunEnv, or RunDir.
type MockRunner ¶
type MockRunner struct {
Calls []Call
// contains filtered or unexported fields
}
MockRunner is an exec.Runner that records calls and returns canned responses.
func (*MockRunner) QueueResponse ¶
func (m *MockRunner) QueueResponse(stdout, stderr string, err error)
QueueResponse enqueues one response to be returned by the next Run/RunEnv call.