Documentation
¶
Overview ¶
Package stubcmd stands in for command-line programs (gh, winget, git) in tests, alike on every OS: Install copies the test binary under the program's name next to a file of rules, and Main, run first by the test binary's TestMain, makes that copy answer by them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Rule ¶
type Rule struct {
// Args matches the arguments joined by spaces, as sh's case "$*" does:
// '*' matches any run of characters, anything else itself.
Args string
Stdout string
Stderr string
Exit int
// Await, when set, is a file the stub waits for before answering: one
// never made is a program that hangs until it is killed.
Await string
// Exec, when set, is a program the stub then runs with its own
// arguments, standard streams and environment, exiting as it does
// (Stdout, Stderr and Exit unused): the real program behind a stub
// that only stands in for some calls.
Exec string
// Log, when set, is a file the stub appends the call to (its arguments
// and environment, see Calls) before answering.
Log string
}
Rule is one answer of a stub.