Package testutil contains common test utilities.
ApplyDir creates the given filesystem layout in the current directory.
InTempHome is like InTestDir, but it also sets HOME to the temporary directory and restores the original HOME in cleanup.
InTestDir is like TestDir, but also changes into the test directory, and the cleanup function also changes back to the original working directory.
It panics if it could not get the working directory or change directory. It is only suitable for use in tests.
Creates an empty file, and panics if an error occurs.
Calls os.MkdirAll and panics if an error is returned.
Calls ioutil.WriteFile and panics if an error occurs.
ScaledMs returns ms milliseconds, scaled by the ELVISH_TEST_TIME_SCALE environment variable. If the variable does not exist, the scale defaults to 1.
TestDir creates a temporary directory for testing. It returns the path of the temporary directory and a cleanup function to remove the temporary directory. The path has symlinks resolved with filepath.EvalSymlinks.
It panics if the test directory cannot be created or symlinks cannot be resolved. It is only suitable for use in tests.
WithTempEnv sets an environment variable to a temporary value, and returns a function for restoring the old value.
Dir describes the layout of a directory. The keys of the map represent filenames. Each value is either a string (for the content of a regular file with permission 0644), a File, or a Dir.
File describes a file to create.