func ChangeWorkingDir(t assert.TestingT, dir string) func()
ChangeWorkingDir to the directory, and return a function which restores the previous working directory.
When used with Go 1.14+ the previous working directory will be restored automatically when the test ends, unless the TEST_NOCLEANUP env var is set to true.
func Patch(t assert.TestingT, key, value string) func()
Patch changes the value of an environment variable, and returns a function which will reset the the value of that variable back to the previous state.
When used with Go 1.14+ the unpatch function will be called automatically when the test ends, unless the TEST_NOCLEANUP env var is set to true.
Deprecated: use t.SetEnv
▹ Example
func PatchAll(t assert.TestingT, env map[string]string) func()
PatchAll sets the environment to env, and returns a function which will reset the environment back to the previous state.
When used with Go 1.14+ the unpatch function will be called automatically when the test ends, unless the TEST_NOCLEANUP env var is set to true.
▹ Example
func ToMap(env []string) map[string]string
ToMap takes a list of strings in the format returned by os.Environ and returns a mapping of keys to values.