package testutil

import "github.com/spf13/viper/internal/testutil"

Index

Functions

func Setenv

func Setenv(t *testing.T, name, val string)

Setenv sets an environment variable to a temporary value for the duration of the test.

At the end of the test (see "Deferred execution" in the package docs), the environment variable is returned to its original value.

func Unsetenv

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

Unsetenv unsets an environment variable for the duration of a test.

Source Files

env.go

Version
v1.8.0
Published
Jun 16, 2021
Platform
linux/amd64
Imports
2 packages
Last checked
59 minutes ago

Tools for package owners.