Documentation
¶
Index ¶
- type ExampleFunc
- type FuncLocation
- type TestFunc
- type TestMain
- func (tm *TestMain) ExecutesTest() bool
- func (tm *TestMain) ExecutesXTest() bool
- func (tm *TestMain) ImportTest() bool
- func (tm *TestMain) ImportXTest() bool
- func (tm *TestMain) Scan(fset *token.FileSet) error
- func (tm *TestMain) Synthesize(fset *token.FileSet) (*build.PackageData, *ast.File, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExampleFunc ¶
type ExampleFunc struct {
Location FuncLocation // Where the function is defined.
Name string // Function name.
Output string // Expected output.
Unordered bool // Output is allowed to be unordered.
EmptyOutput bool // Whether the output is expected to be empty.
}
ExampleFunc describes an example.
func (ExampleFunc) Executable ¶
func (ef ExampleFunc) Executable() bool
Executable returns true if the example function should be executed with tests.
type FuncLocation ¶
type FuncLocation uint8
FuncLocation describes whether a test function is in-package or external (i.e. in the xxx_test package).
const ( // LocUnknown is the default, invalid value of the PkgType. LocUnknown FuncLocation = iota // LocInPackage is an in-package test. LocInPackage // LocExternal is an external test (i.e. in the xxx_test package). LocExternal )
func (FuncLocation) String ¶
func (tl FuncLocation) String() string
type TestFunc ¶
type TestFunc struct {
Location FuncLocation // Where the function is defined.
Name string // Function name.
}
TestFunc describes a single test/benchmark/fuzz function in a package.
type TestMain ¶
type TestMain struct {
Package *build.PackageData
Tests []TestFunc
Benchmarks []TestFunc
Fuzz []TestFunc
Examples []ExampleFunc
TestMain *TestFunc
}
TestMain is a helper type responsible for generation of the test main package.
func (*TestMain) ExecutesTest ¶
ExecutesTest returns true if in-package test package has executable tests.
func (*TestMain) ExecutesXTest ¶
ExecutesXTest returns true if external package test package has executable tests.
func (*TestMain) ImportTest ¶
ImportTest returns true if in-package test package needs to be imported.
func (*TestMain) ImportXTest ¶
ImportXTest returns true if external test package needs to be imported.
func (*TestMain) Synthesize ¶
Synthesize main package for the tests.