Documentation
¶
Overview ¶
Package testconfig parses and validates project test.config.json shared by xgo test-explorer and consumers such as doctest.
Index ¶
Constants ¶
const DefaultFileName = "test.config.json"
DefaultFileName is the conventional project-root config file name.
Variables ¶
This section is empty.
Functions ¶
func CompareGoVersion ¶
CompareGoVersion compares major/minor (and patch unless ignorePatch). Returns a-b style: negative if a < b, zero if equal, positive if a > b.
func ValidateGoConstraint ¶
ValidateGoConstraint checks a go.min/go.max block against goBinary version.
func ValidateGoVersion ¶
ValidateGoVersion checks cfg.Go min/max against the host Go toolchain. goBinary defaults to "go" when empty. No-op when cfg or constraints are empty. Invalid min/max tokens are ignored (same as historical xgo explorer behavior).
Types ¶
type Config ¶
type Config struct {
Go *GoConfig `json:"go"`
GoCmd string `json:"go_cmd"`
Exclude []string `json:"exclude"`
Env map[string]interface{} `json:"env"`
// Flags are passed to go/xgo test (e.g. -p=12, --trap-stdlib=false).
Flags []string `json:"flags"`
// Args are test-binary program args (after -args).
Args []string `json:"args"`
BypassGoFlags bool `json:"bypass_go_flags"`
// MockRules are re-marshaled JSON objects for --mock-rule.
MockRules []string `json:"mock_rules"`
Xgo *XgoConfig `json:"xgo,omitempty"`
Coverage *CoverageConfig `json:"coverage,omitempty"`
}
Config is the shared subset of test.config.json fields. Product-specific keys (e.g. doctest pre_test) may appear in the file and are ignored by Parse.
func Parse ¶
Parse unmarshals test.config.json bytes into Config. Unknown top-level keys (e.g. pre_test) are ignored.
type CoverageConfig ¶
type CoverageConfig struct {
Disabled bool `json:"disabled"`
DiffWith string `json:"diff_with"`
Profile string `json:"profile"`
Include []string `json:"include"`
Exclude []string `json:"exclude"`
}
CoverageConfig controls coverage integration (enabled by default when present).