testcount

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testcount counts the expensive operations that test helpers start and prints the counts of a package at the end of its test run, for internal/testtime to check against testdata/test-time-budget.txt.

Index

Constants

View Source
const (
	Servers   = "servers"
	Schemas   = "schemas"
	Processes = "processes"
)

The names of the counts.

View Source
const Prefix = "motte-testcount "

Prefix starts the one output line that carries the counts of a package.

Variables

This section is empty.

Functions

func Add

func Add(t testing.TB, name string)

Add counts one operation. In a package of this module that does not call Run from its TestMain, it fails the test, because the count would be lost.

func Command

func Command(t testing.TB, name string, args ...string) *exec.Cmd

Command counts a started process and returns exec.Command(name, args...).

func Line

func Line(counts map[string]int, runs int) string

Line renders the count line for the counts of runs runs of the tests. Each count is divided by runs, rounded up.

func Parse

func Parse(output string) (map[string]int, bool)

Parse returns the counts of a test output that holds a count line. The bool is false when it holds none.

func Run

func Run(m *testing.M) int

Run runs the tests of m, prints the count line and returns the exit code. Use it as os.Exit(testcount.Run(m)).

Types

This section is empty.

Jump to

Keyboard shortcuts

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