cmdtest

package
v2.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DumbCmd

type DumbCmd struct{}

func NewDumb

func NewDumb() *DumbCmd

NewDumb returns executor that does simply nothing.

func (*DumbCmd) Run

func (c *DumbCmd) Run(_ []string, _ string, _ io.Reader, _ io.Writer, _ io.Writer) error

Run does nothing.

func (*DumbCmd) WithoutEnvs

func (c *DumbCmd) WithoutEnvs(_ ...string) system.Command

WithoutEnvs does nothing.

type OrderedCmd

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

OrderedCmd contains predefined list of commands and makes sure actual calls are the same.

func NewOrdered

func NewOrdered(t testing.TB, outs []Out) *OrderedCmd

NewOrdered returns executor that have the order defined in `outs`.

func (*OrderedCmd) Run

func (c *OrderedCmd) Run(command []string, root string, in io.Reader, out io.Writer, err io.Writer) error

Run makes sure command is executed correctly.

func (*OrderedCmd) WithoutEnvs

func (c *OrderedCmd) WithoutEnvs(envs ...string) system.Command

WithoutEnvs simply does nothing.

type Out

type Out struct {
	Command string
	Output  string
}

type TrackingCmd

type TrackingCmd struct {
	Commands []string
	// contains filtered or unexported fields
}

func NewTracking

func NewTracking(cb func(string, string, io.Writer) error) *TrackingCmd

NewTracking returns executor that collects the called commands.

func (*TrackingCmd) Reset

func (c *TrackingCmd) Reset()

func (*TrackingCmd) Run

func (c *TrackingCmd) Run(command []string, root string, in io.Reader, out io.Writer, err io.Writer) error

Run makes sure command is executed correctly.

func (*TrackingCmd) RunWithContext

func (c *TrackingCmd) RunWithContext(_ context.Context, command []string, root string, in io.Reader, out io.Writer, err io.Writer) error

func (*TrackingCmd) WithoutEnvs

func (c *TrackingCmd) WithoutEnvs(envs ...string) system.Command

WithoutEnvs simply does nothing.

Jump to

Keyboard shortcuts

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