testutil

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetFs func() afero.Fs

GetFs is a function that returns an Fs

View Source
var SetFs func(fs afero.Fs)

SetFs sets an app Fs

Functions

func IsHelper added in v0.2.0

func IsHelper() bool

IsHelper returns true if a process helper is wanted

func ReplaceFs

func ReplaceFs() func()

ReplaceFs replaces the real filesystem by a memory implementation

func TestFailRunHelper added in v0.12.0

func TestFailRunHelper()

TestFailRunHelper is a non zero exiting testing helper for go test subprocess mocking.

func TestSummonRunHelper added in v0.12.0

func TestSummonRunHelper()

TestSummonRunHelper is a testing helper for go test subprocess mocking

Types

type Call

type Call struct {
	Args []string
	Env  []string
	Out  string
}

Call is a recording of a fake call

type FakeCommand added in v0.16.0

type FakeCommand struct {
	Fn    func(string, ...string) *command.Cmd
	Calls []Call
}

func FakeExecCommand

func FakeExecCommand(testToCall string) *FakeCommand

FakeExecCommand returns a FakeCommand which can record calls this is used to mock an exec.Cmd Adapted from https://npf.io/2015/06/testing-exec-command/

func (*FakeCommand) GetCalls added in v0.16.0

func (fc *FakeCommand) GetCalls() []Call

Jump to

Keyboard shortcuts

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