fake

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdSpec

type CmdSpec struct {
	// Regular expression to match against the " "-joined command
	Match string
	// Stdout to return from the command
	Stdout string
}

CmdSpec specifies a command for the fake Commander

type Commander

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

Commander records the commands instead of executing them. It also provides stdout based on a table of (cmd_regexp, stdout) pairs. The regexp is matched against the command and its arguments joined with " ".

func NewCommander

func NewCommander(rec testutils.Recorder, specs []CmdSpec) *Commander

NewCommander creates a new Commander. If rec is nil, all the commands will not be recorded

func (*Commander) Command

func (c *Commander) Command(name string, arg ...string) utils.Command

Command implements the Command method of Commander interface.

func (*Commander) ReplaceTempPath

func (c *Commander) ReplaceTempPath(pathSuffix, replacement string)

ReplaceTempPath makes the commander replace the path with specified suffix with the specified string. The replacement is done on the word boundary.

Jump to

Keyboard shortcuts

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