testdeps

package standard library
go1.26.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation ΒΆ

Overview ΒΆ

Package testdeps provides access to dependencies needed by test execution.

This package is imported by the generated main package, which passes TestDeps into testing.Main. This allows tests to use packages at run time without making those packages direct dependencies of package testing. Direct dependencies of package testing are harder to write tests for.

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

View Source
var (
	CoverSnapshotFunc           func() float64
	CoverProcessTestDirFunc     func(dir string, cfile string, cm string, cpkg string, w io.Writer, selpkgs []string) error
	CoverMarkProfileEmittedFunc func(val bool)
)

These variables below are set at runtime (via code in testmain) to point to the equivalent functions in package internal/coverage/cfile; doing things this way allows us to have tests import internal/coverage/cfile only when -cover is in effect (as opposed to importing for all tests).

View Source
var Cover bool

Cover indicates whether coverage is enabled.

View Source
var CoverMode string
View Source
var CoverSelectedPackages []string
View Source
var Covered string
View Source
var ImportPath string

ImportPath is the import path of the testing binary, set by the generated main function.

View Source
var ModulePath string

Functions ΒΆ

This section is empty.

Types ΒΆ

type TestDeps ΒΆ

type TestDeps struct{}

TestDeps is an implementation of the testing.testDeps interface, suitable for passing to testing.MainStart.

func (TestDeps) CheckCorpus ΒΆ added in go1.18

func (TestDeps) CheckCorpus(vals []any, types []reflect.Type) error

func (TestDeps) CoordinateFuzzing ΒΆ added in go1.18

func (TestDeps) CoordinateFuzzing(
	timeout time.Duration,
	limit int64,
	minimizeTimeout time.Duration,
	minimizeLimit int64,
	parallel int,
	seed []fuzz.CorpusEntry,
	types []reflect.Type,
	corpusDir,
	cacheDir string) (err error)

func (TestDeps) ImportPath ΒΆ added in go1.9

func (TestDeps) ImportPath() string

func (TestDeps) InitRuntimeCoverage ΒΆ added in go1.23.0

func (TestDeps) InitRuntimeCoverage() (mode string, tearDown func(string, string) (string, error), snapcov func() float64)

func (TestDeps) MatchString ΒΆ

func (TestDeps) MatchString(pat, str string) (result bool, err error)

func (TestDeps) ModulePath ΒΆ added in go1.26.0

func (TestDeps) ModulePath() string

func (TestDeps) ReadCorpus ΒΆ added in go1.18

func (TestDeps) ReadCorpus(dir string, types []reflect.Type) ([]fuzz.CorpusEntry, error)

func (TestDeps) ResetCoverage ΒΆ added in go1.18

func (TestDeps) ResetCoverage()

func (TestDeps) RunFuzzWorker ΒΆ added in go1.18

func (TestDeps) RunFuzzWorker(fn func(fuzz.CorpusEntry) error) error

func (TestDeps) SetPanicOnExit0 ΒΆ added in go1.16

func (TestDeps) SetPanicOnExit0(v bool)

SetPanicOnExit0 tells the os package whether to panic on os.Exit(0).

func (TestDeps) SnapshotCoverage ΒΆ added in go1.18

func (TestDeps) SnapshotCoverage()

func (TestDeps) StartCPUProfile ΒΆ

func (TestDeps) StartCPUProfile(w io.Writer) error

func (TestDeps) StartTestLog ΒΆ added in go1.10

func (TestDeps) StartTestLog(w io.Writer)

func (TestDeps) StopCPUProfile ΒΆ

func (TestDeps) StopCPUProfile()

func (TestDeps) StopTestLog ΒΆ added in go1.10

func (TestDeps) StopTestLog() error

func (TestDeps) WriteProfileTo ΒΆ

func (TestDeps) WriteProfileTo(name string, w io.Writer, debug int) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL