timing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Tests      []TestTiming  `json:"tests"`
	DefaultDur time.Duration `json:"default_duration"`
	// contains filtered or unexported fields
}

Cache holds timing data for tests and provides lookup functionality.

func LoadCache

func LoadCache(path string) (*Cache, error)

LoadCache reads timing data from a JSON file. Returns an empty cache if the file doesn't exist.

func (*Cache) GetDuration

func (c *Cache) GetDuration(pkg, name string) time.Duration

GetDuration returns the duration for a test, falling back to default if unknown. Looks up by full name (package.TestName) first, then just test name.

func (*Cache) Len

func (c *Cache) Len() int

Len returns the number of tests in the cache.

func (*Cache) Save

func (c *Cache) Save(path string) error

Save writes timing data to a JSON file.

func (*Cache) Update

func (c *Cache) Update(timings []TestTiming)

Update merges new timing data into the cache.

type TestTiming

type TestTiming struct {
	Name     string        `json:"name"`
	Package  string        `json:"package"`
	Duration time.Duration `json:"duration"`
}

TestTiming holds duration data for a single test.

func ParseTestOutput

func ParseTestOutput(r io.Reader) ([]TestTiming, error)

ParseTestOutput reads `go test -json` output and extracts timing data.

Jump to

Keyboard shortcuts

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