sandbox

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(t *testing.T, actionF func() carapace.Action) (f func(func(s *Sandbox)))

Action executes a a command with the action return by given function as PositionalAny.

func Command

func Command(t *testing.T, cmdF func() *cobra.Command) (f func(func(s *Sandbox)))

Command executes the command generated by given function.

func Package

func Package(t *testing.T, pkg string) (f func(func(s *Sandbox)))

Package invokes `go run` on given package.

Types

type Sandbox

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

func (*Sandbox) ClearCache

func (s *Sandbox) ClearCache()

func (*Sandbox) Env

func (s *Sandbox) Env(key, value string)

func (*Sandbox) Files

func (s *Sandbox) Files(args ...string)

Files creates files within the sandbox directory.

s.Files(
	"file1.txt", "content of file1.txt",
	"dir1/file2.md", "content of file2.md",
)

func (*Sandbox) Keep

func (s *Sandbox) Keep()

Keep prevents removal of the sandbox directory.

func (*Sandbox) NewContext

func (s *Sandbox) NewContext(args ...string) carapace.Context

NewContext creates a new context enriched with sandbox specifics.

func (*Sandbox) Reply

func (s *Sandbox) Reply(args ...string) reply

Reply mocks a command for given arguments (Only works for `(Context).Command`).

func (*Sandbox) Run

func (s *Sandbox) Run(args ...string) run

Run executes the sandbox with given arguments.

Jump to

Keyboard shortcuts

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