exectest

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 13 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 exectest provides helpers for testing code that spawns subprocesses by re-entering the test binary as the child process.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Path returns the path to the test executable.
	Path = sync.OnceValues(os.Executable)

	// DefaultCommands contains built-in helper commands available to re-entered test binaries.
	DefaultCommands = map[string]func([]string) int{
		"exit": cmdExitCode,
		"echo": cmdEcho,
		"wait": cmdWait,
	}
)

Functions

func New

func New(t *testing.T, name string, args ...string) *exec.Executable

New returns a new test command.

func Run

func Run(args []string, commandFns map[string]func([]string) int) int

Run dispatches to the named command in commands using args. It is intended to be called from TestMain when the process has been re-entered.

Types

This section is empty.

Jump to

Keyboard shortcuts

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