cmdtest

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BinaryPath string

BinaryPath is set by TestMain to point to the compiled gplay binary.

Functions

func AssertExitCode

func AssertExitCode(t *testing.T, got, want int)

AssertExitCode asserts that the exit code matches expected.

func AssertStderrContains

func AssertStderrContains(t *testing.T, stderr, substring string)

AssertStderrContains asserts that stderr contains the given substring.

func AssertStdoutContains

func AssertStdoutContains(t *testing.T, stdout, substring string)

AssertStdoutContains asserts that stdout contains the given substring.

func Build

func Build(t *testing.T)

Build compiles the gplay binary into a temp directory and sets BinaryPath.

Types

type Result

type Result struct {
	Stdout   string
	Stderr   string
	ExitCode int
}

Result holds the output of a CLI command execution.

func Run

func Run(t *testing.T, args ...string) Result

Run executes the gplay binary with the given arguments and returns the result.

func RunJSON

func RunJSON(t *testing.T, args ...string) (map[string]interface{}, Result)

RunJSON runs the binary and parses stdout as JSON.

Jump to

Keyboard shortcuts

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