testutils

package
v0.2.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempFile

func CreateTempFile(t *testing.T, content string) string

CreateTempFile creates a temporary file with the given content. The file will be automatically removed when the test that created it is complete.

Types

type CommandAssertion

type CommandAssertion func(*testing.T, CommandResult)

func CommandErrorContains

func CommandErrorContains(message string) CommandAssertion

func CommandOutputContains

func CommandOutputContains(expected string) CommandAssertion

func CommandOutputEquals

func CommandOutputEquals(expected string) CommandAssertion

func CommandSuccess

func CommandSuccess() CommandAssertion

type CommandResult

type CommandResult struct {
	Err    error
	Stdout string
}

type CommandTestCase

type CommandTestCase struct {
	Cmd     *cobra.Command
	Command []string

	Assertions []CommandAssertion

	Stdin io.Reader
	Env   map[string]string
}

func (CommandTestCase) RestoreEnv

func (testCase CommandTestCase) RestoreEnv(env map[string]string)

func (CommandTestCase) Run

func (testCase CommandTestCase) Run(t *testing.T)

func (CommandTestCase) SetEnv

func (testCase CommandTestCase) SetEnv() map[string]string

Jump to

Keyboard shortcuts

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