testutils

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertError

func AssertError(t *testing.T, err error, expectedMsg string)

AssertError asserts that an error is not nil and contains the expected message.

func AssertNoError

func AssertNoError(t *testing.T, err error)

AssertNoError asserts that an error is nil.

func CaptureStdout

func CaptureStdout(t *testing.T) (string, func())

CaptureStdout captures the output of stdout during a test. It returns the captured string and a function to restore stdout.

func ClearEnv

func ClearEnv(t interface {
	Helper()
	Setenv(key, value string)
}, keys []string) func()

ClearEnv clears a list of environment variables. It returns a cleanup function that restores the original environment variables.

func GetEnvMapFromStrings

func GetEnvMapFromStrings(envStrings []string) map[string]string

GetEnvMapFromStrings converts a slice of "KEY=VALUE" strings into a map.

func SetEnv

func SetEnv(t interface {
	Helper()
	Setenv(key, value string)
}, env map[string]string) func()

SetEnv temporarily sets environment variables for the duration of a test. It returns a cleanup function that restores the original environment variables.

Types

This section is empty.

Jump to

Keyboard shortcuts

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