Documentation
¶
Index ¶
- Constants
- type Result
- type Scenario
- func (s Scenario) BeforeRun(stage *cage_file_stage.Stage) error
- func (s Scenario) GetRootDir() string
- func (s Scenario) Gopath() string
- func (s Scenario) Id() int
- func (s *Scenario) PermuteAxes() (axes []interface{})
- func (s Scenario) PermuteId(subject interface{}, id int) interface{}
- func (s *Scenario) PermuteNew(subject, axis, value interface{}) interface{}
- func (s *Scenario) PermuteSubject() interface{}
- func (s *Scenario) PermuteValues(axis interface{}) (values []interface{})
- func (s Scenario) Run(ctx context.Context, args []string) (res Result, err error)
- func (s Scenario) String() string
- func (s Scenario) UsableGopath() string
- func (s Scenario) Wd() string
Constants ¶
const ( // Scenario.GOPATH selection modes EmptyGopath = iota UsableGopath UnusedGopath // Scenario.WD selection modes WdInsideGopath = iota WdOutsideGopath )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// Scenario is a copy of the executed scenario spec.
Scenario Scenario
// Err is non-nil if the scenario's command fails to start, exits with a non-zero code,
// or its context times out.
//
// It is also non-nil if `go env` fails before running the scenario's command.
Err error
// Code is from the scenario's command.
//
// It is -1 if the command does not get an opporunity to run, e.g. if `go env` fails
// for some reason.
Code int
// GoEnv is the output of `go env` prior to running the scenario.
GoEnv string
// Stderr is from the scenario's command.
Stderr string
// Stdout is from the scenario's command.
Stdout string
}
Result is the outcome of one execution of the input command in one Scenario.
type Scenario ¶
type Scenario struct {
// GO111MODULE is the environment variable value applied to the scenario.
//
// It is assigned a value by a permutation generator. The generator assigns one of
// three values: "auto", "off", "on".
GO111MODULE string
// GOFLAGS is the environment variable value applied to the scenario.
//
// It is assigned a value by a permutation generator. The generator assigns one of
// two values: empty string or "-mod=vendor".
GOFLAGS string
// GOPATH is a mode of selecting environment variable value applied to the scenario.
//
// It is assigned a value by a permutation generator. The generator assigns one of three modes
// which select these path types: a path which may contain the working directory as a descendant,
// a path which never contains the working directory, and an empty string.
GOPATH int
// IN_MODULE is true if the command should in a working directory with a go.mod.
//
// It is assigned a value by a permutation generator.
IN_MODULE bool
// Wd is a mode of selecting the working directory in which the command runs.
//
// It is assigned a value by a permutation generator. The generator assigns one of
// two modes which select these path types: "<Scenario.rootDir>/<scenario dir>/wd" or
// "<Scenario.rootDir>/<scenario dir>/gopath/wd".
WD int
// contains filtered or unexported fields
}
Scenario defines how a command should be executed in a scenario.
func NewScenario ¶
NewScenario returns an initialized value.
func (Scenario) BeforeRun ¶
func (s Scenario) BeforeRun(stage *cage_file_stage.Stage) error
BeforeRun sets up the environment in preparation for Run.
func (Scenario) GetRootDir ¶
GetRootDir returns the top of the scenario's file tree.
func (*Scenario) PermuteAxes ¶
func (s *Scenario) PermuteAxes() (axes []interface{})
PermuteAxes enumerates all the fields whose possible values should yield permutations, e.g. "size" and "color".
It implements Permutator.
func (*Scenario) PermuteNew ¶
func (s *Scenario) PermuteNew(subject, axis, value interface{}) interface{}
PermuteNew returns a new permutation with the input axis assigned the input value.
It implements Permutator.
func (*Scenario) PermuteSubject ¶
func (s *Scenario) PermuteSubject() interface{}
PermuteSubject returns a zero-valued subject from which permutations are created.
It implements Permutator.
func (*Scenario) PermuteValues ¶
func (s *Scenario) PermuteValues(axis interface{}) (values []interface{})
PermuteValues returns all possible values of the input axis, e.g. "red" and "green" for axis "colors".
It implements Permutator.
func (Scenario) Run ¶
Run applies the permutation-defined fields, runs the command, and returns the result.