ostest

package
v0.0.0-...-651394c Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chdir

func Chdir(t *testing.T, dir string)

Chdir changes the current working directory to the named directory. The working directory is automatically restored as part of Cleanup.

func CombinedPaths

func CombinedPaths(environ []string) string

CombinedPaths collects all PATH strings from the provided environment variables, in the form of 'PATH=<path>', and combines them into a single PATH string, also in the form of 'PATH=<collected paths>'. It returns an empty string if no PATH strings are found.

func Create

func Create(t *testing.T, name string)

Create creates or truncates the named file. If the file already exists, it is truncated. If the file does not exist, it is created with mode 0666 (before umask). Files created are automatically removed during test Cleanup. Ignores errors due to the file already being deleted.

func CreateNoCleanup

func CreateNoCleanup(t *testing.T, name string)

Create creates or truncates the named file. If the file already exists, it is truncated. If the file does not exist, it is created with mode 0666 (before umask).

func Setenv

func Setenv(t *testing.T, key string, value string)

Setenv calls t.Setenv with the provided key and value.

func Setenvs

func Setenvs(t *testing.T, envContext map[string]string)

Setenvs sets the provided environment variables keys with their corresponding values. Any set values are automatically restored during test Cleanup.

func Unsetenv

func Unsetenv(t *testing.T, key string)

Unsetenv unsets the environment variable, which is later restored during test Cleanup.

func Unsetenvs

func Unsetenvs(t *testing.T, keys []string)

Unsetenvs unsets the provided environment variables, which is later restored during test Cleanup.

Types

This section is empty.

Jump to

Keyboard shortcuts

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