test

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFixture

func LoadFixture(name string) ([]byte, error)

LoadFixture loads the content of a fixture file.

func LoadFixtureReader

func LoadFixtureReader(name string) (io.Reader, error)

LoadFixtureReader loads the content of a fixture file and returns with an io.Reader.

func Must

func Must(content []byte, err error) []byte

Must be content. Basically go and panic if error happened.

Types

type CommandWithOutput

type CommandWithOutput struct {
	Command               string
	StdOut                []byte
	StdErr                []byte
	ExpectedNumberOfCalls int
	NumberCalls           int
}

CommandWithOutput is a wrapper for tests.

type Executor

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

Executor is for Commander to test.

func NewExecutor

func NewExecutor(commands []CommandWithOutput) *Executor

NewExecutor is a factory to create Executor.

func (*Executor) Command

func (e *Executor) Command(cmd string, args ...string) exec.Cmd

Command is for single run commands.

func (*Executor) CommandContext

func (e *Executor) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd

CommandContext is for commands with context.

func (*Executor) LookPath

func (e *Executor) LookPath(file string) (string, error)

LookPath wraps os/exec.LookPath.

func (*Executor) Reset

func (e *Executor) Reset()

Reset resets Executor stacks.

func (*Executor) Validate

func (e *Executor) Validate() error

Validate validates the Executor stacks.

type FixtureFileNotFound

type FixtureFileNotFound struct {
	Path string
	Name string
}

FixtureFileNotFound occurs when the requested fixture file does not exist.

func (FixtureFileNotFound) Error

func (e FixtureFileNotFound) Error() string

type MissingCallError

type MissingCallError struct {
	Command  string
	Expected int
	Actual   int
}

MissingCallError is for missing errors.

func (MissingCallError) Error

func (e MissingCallError) Error() string

type UnexpectedCommandCallError

type UnexpectedCommandCallError struct {
	Command string
}

UnexpectedCommandCallError is error.

func (UnexpectedCommandCallError) Error

Jump to

Keyboard shortcuts

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