Documentation
¶
Overview ¶
Package gitfail puts a git on PATH that runs the real git except where a test wants a call to fail or print nothing. It lets a test reach the error returns of git calls that succeed on any real repository.
Each function sets PATH with t.Setenv, so a test that calls one MUST NOT run in parallel.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SilentWhenArg ¶
SilentWhenArg makes git exit 0 and print nothing when one of its arguments equals arg.
func WhenArg ¶
WhenArg makes git exit with code, and "injected failure" on stderr, when one of its arguments equals arg. A config lookup reads exit 1 as an unset key, so a test that wants its error return passes 2.
func WhenContains ¶
WhenContains makes git exit 2 with "injected failure" on stderr when its arguments, joined by spaces, contain pattern. Exit code 2 is neither of the codes gitx reads as an answer, so the call fails as any broken git would.
Types ¶
This section is empty.