exectest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 13 Imported by: 0

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