Documentation ¶
Index ¶
- Variables
- type Case
- type Environment
- func (te *Environment) AddEnv(e string)
- func (te *Environment) Cleanup()
- func (te *Environment) CopyTree(src string)
- func (te *Environment) GetStderr() string
- func (te *Environment) GetStdout() string
- func (te *Environment) Join(args ...string) string
- func (te *Environment) MakeDir(args ...string)
- func (te *Environment) Run(progName string, args []string) error
- type RunFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ExeSuffix is the suffix of executable files (.exe on Windows). ExeSuffix string // Verbose controls logging of test commands. Verbose = flag.Bool("logs", false, "log stdin/stdout of test commands") // UpdateGolden controls updating test fixtures. UpdateGolden = flag.Bool("update", false, "update golden files") )
Functions ¶
This section is empty.
Types ¶
type Case ¶
type Case struct { Commands [][]string `json:"commands"` Skip bool `json:"skip"` Environ []string `json:"environ"` // contains filtered or unexported fields }
Case loads a testdata.json test configuration and executes that test.
func (*Case) CompareError ¶
CompareError compares stderr to the contents of a stderr file in the test directory.
func (*Case) CompareOutput ¶
CompareOutput compares stdout to the contents of a stdout file in the test directory.
func (*Case) InitialPath ¶
func (*Case) UpdateStdout ¶
UpdateStdout updates the golden file for stdout with the working result.
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment defines a test execution environment and captures the output.
func NewEnvironment ¶
func NewEnvironment(t *testing.T, rootPath, wd string, run RunFunc) *Environment
NewEnvironment initializes the test Environment.
func (*Environment) AddEnv ¶
func (te *Environment) AddEnv(e string)
func (*Environment) Cleanup ¶
func (te *Environment) Cleanup()
func (*Environment) CopyTree ¶
func (te *Environment) CopyTree(src string)
func (*Environment) GetStderr ¶
func (te *Environment) GetStderr() string
GetStderr returns the captures stderr.
func (*Environment) GetStdout ¶
func (te *Environment) GetStdout() string
GetStdout returns the captures stdout.
func (*Environment) Join ¶
func (te *Environment) Join(args ...string) string
Join returns a path rooted at the environment's tempdir.
func (*Environment) MakeDir ¶
func (te *Environment) MakeDir(args ...string)
Click to show internal directories.
Click to hide internal directories.