tests

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copied from MIT licensed https://github.com/rendon/testcli

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

Command is typically constructed through the Command() call and provides state to the execution engine.

func NewCommand

func NewCommand(ctx context.Context, name string, arg ...string) *Command

func (*Command) Error

func (c *Command) Error() error

Error is the command's error, if any.

func (*Command) Failure

func (c *Command) Failure() bool

Failure is the inverse of Success().

func (*Command) SendInterrupt

func (c *Command) SendInterrupt()

func (*Command) SetEnv

func (c *Command) SetEnv(env []string)

SetEnv overwrites the environment with the provided one. Otherwise, the parent environment will be supplied.

func (*Command) SetStdin

func (c *Command) SetStdin(stdin io.Reader)

SetStdin sets the stdin stream. It makes no attempt to determine if the command accepts anything over stdin.

func (*Command) Start

func (c *Command) Start()

Run runs the command.

func (*Command) Stderr

func (c *Command) Stderr() string

Stderr stream for the command

func (*Command) StderrContains

func (c *Command) StderrContains(str string) bool

StderrContains determines if command's STDERR contains `str`, this operation is case insensitive.

func (*Command) StderrMatches

func (c *Command) StderrMatches(regex string) bool

StderrMatches compares a regex to the stderr produced by the command.

func (*Command) Stdout

func (c *Command) Stdout() string

Stdout stream for the command

func (*Command) StdoutContains

func (c *Command) StdoutContains(str string) bool

StdoutContains determines if command's STDOUT contains `str`, this operation is case insensitive.

func (*Command) StdoutMatches

func (c *Command) StdoutMatches(regex string) bool

StdoutMatches compares a regex to the stdout produced by the command.

func (*Command) Success

func (c *Command) Success() bool

Success is a boolean status which indicates if the program exited non-zero or not.

func (*Command) Wait

func (c *Command) Wait()

Jump to

Keyboard shortcuts

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