Help us shape the future of Go! Take the 2026 Go Developer Survey

hookstest

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package hookstest provides a portable hook program for tests: the test binary re-executes itself, so tests need no shell or jq.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hook

func Hook(t testing.TB, match, mode string, args ...string) config.Hook

Hook returns a hook entry running mode with args:

stdout TEXT       print TEXT, exit 0
exit2 TEXT        print TEXT to stderr, exit 2
exit N            exit with status N
sleep [PIDFILE]   write the pid to PIDFILE if given, then sleep
stdin FILE        copy stdin to FILE, exit 0
env FILE          write the environment to FILE, exit 0
log FILE TAG      append TAG and a newline to FILE, exit 0
gate DIR N TEXT   save stdin as DIR/<run>.json; print TEXT to stderr
                  and exit 2 for the first N runs, then exit 0

func Run

func Run()

Run acts as the hook and exits when the test binary was started by a hook from Hook. Call it first in TestMain.

Types

This section is empty.

Jump to

Keyboard shortcuts

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