{"modulePath":"github.com/DomBlack/git-stack","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package exectest\n\nPackage exectest provides a scripted exec.Runner for unit tests.\n\n## Types\n\n```go\ntype Call struct {\n\tName  string\n\tArgs  []string\n\tDir   string\n\tMode  exec.Mode\n\tStdin string\n}\n```\nCall records one invocation of the fake runner.\n\n```go\nfunc (c Call) String() string\n```\nString renders the call as a command line.\n\n```go\ntype Fake struct {\n\n\t// Fallback handles commands no rule matches. By default it fails the\n\t// call with an \"unexpected command\" error.\n\tFallback func(exec.Cmd) (exec.Result, error)\n\t// contains filtered or unexported fields\n}\n```\nFake is an exec.Runner that replays scripted results and records calls. Rules are matched by executable name and argument prefix; the most recently added matching rule wins.\n\n```go\nfunc New() *Fake\n```\nNew returns an empty Fake.\n\n```go\nfunc (f *Fake) Calls() []Call\n```\nCalls returns every recorded call.\n\n```go\nfunc (f *Fake) CallsTo(name string) []Call\n```\nCallsTo returns the recorded calls for the given executable.\n\n```go\nfunc (f *Fake) On(name string, argPrefix ...string) *Stub\n```\nOn registers a rule for name whose arguments start with argPrefix.\n\n```go\nfunc (f *Fake) Reset()\n```\nReset forgets recorded calls but keeps the rules.\n\n```go\nfunc (f *Fake) Run(_ context.Context, c exec.Cmd) (exec.Result, error)\n```\nRun implements exec.Runner.\n\n```go\ntype Stub struct {\n\t// contains filtered or unexported fields\n}\n```\nStub configures the reply for one rule.\n\n```go\nfunc (s *Stub) Do(fn func(exec.Cmd) (exec.Result, error)) *Stub\n```\nDo installs an arbitrary handler.\n\n```go\nfunc (s *Stub) Fail(code int, stderr string) *Stub\n```\nFail makes the rule exit with code and the given stderr, returned as an \\*exec.ExitError like the real runner.\n\n```go\nfunc (s *Stub) NotFound() *Stub\n```\nNotFound makes the rule report a missing executable.\n\n```go\nfunc (s *Stub) Reply(stdout string) *Stub\n```\nReply makes the rule succeed with the given stdout.\n\n","path":"github.com/DomBlack/git-stack/pkg/exec/exectest","name":"exectest","synopsis":"Package exectest provides a scripted exec.Runner for unit tests.","isRedistributable":true}
