blockcmd

package
v0.0.0-...-ed5509b Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNotDone

func MustNotDone(cmd *blockingCmd, f func())

MustNotDone executes a function after checking whether the context is canceled. If the context is canceled a test failure is registered, halting all tests.

func WhenNotDone

func WhenNotDone(cmd *blockingCmd, f func())

WhenNotDone executes a function after checking whether the context is canceled. If the context is canceled a test error is registered and returned.

Types

type BlockingCmdResults

type BlockingCmdResults struct {
	// contains filtered or unexported fields
}

func (*BlockingCmdResults) ExitCode

func (blockingCmd *BlockingCmdResults) ExitCode() int

func (*BlockingCmdResults) Stderr

func (blockingCmd *BlockingCmdResults) Stderr() []string

func (*BlockingCmdResults) Stdout

func (blockingCmd *BlockingCmdResults) Stdout() []string

type Cmd

type Cmd interface {
	CmdString() []string

	WhileBlocking(f func(cmd Cmd)) (result Results, ok bool)
	WhileStillBlocking(f func())
	MustNotDone(f func())
	Stop() error
	Done() <-chan struct{}

	Fatal(args ...any)
	Fatalf(format string, args ...any)
}

func New

func New(t *testing.T, cmd []string) Cmd

type Results

type Results interface {
	Stdout() []string
	Stderr() []string
	ExitCode() int
}

func WithBlockingCmdObj

func WithBlockingCmdObj(blockingCmdFuncArg *blockingCmd, f func(cmd Cmd)) (result Results, ok bool)

func WithBlockingCmdStr

func WithBlockingCmdStr(t *testing.T, cmdStr []string, f func(cmd Cmd)) (result Results, ok bool)

Jump to

Keyboard shortcuts

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