testkit

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package testkit runs programs built on gonsole from tests, in process and as built binaries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoverBinary

func CoverBinary(t testing.TB, prefix, name string) (string, []string)

CoverBinary returns the cover built binary called name and its environment, skipping outside a cover run.

func FreeAddr

func FreeAddr(t testing.TB) string

FreeAddr returns a loopback address whose port nothing listens on.

func Getenv

func Getenv(values map[string]string) func(string) string

Getenv returns a getenv that reads only values.

func WaitForListening

func WaitForListening(t testing.TB, stderr io.Reader)

WaitForListening blocks until the server logs on stderr that it is listening.

Types

type Result

type Result struct {
	// Code is the exit code the run returned.
	Code int
	// Stdout is everything the run wrote to standard output.
	Stdout string
	// Stderr is everything the run wrote to standard error.
	Stderr string
}

Result is what one in process run answers.

func Run

func Run(t testing.TB, p gonsole.Program, stdin string, args ...string) Result

Run runs p with args in process, feeding stdin, and answers its exit code and output.

Jump to

Keyboard shortcuts

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