Documentation ¶
Overview ¶
Package testfiles provides utilities for writing Go tests with files in testdata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDirToTmp ¶
CopyDirToTmp copies dir to a temporary test directory using CopyTestFiles and returns the path to the test directory.
func CopyFS ¶
CopyFS copies the files and directories in src to a destination directory dst. Paths to files and directories ending in a ".test" extension have the ".test" extension removed. This allows tests to hide files whose names have special meaning, such as "go.mod" files or "testdata" directories from the go command, or ill-formed Go source files from gofmt.
For example if we copy the directory testdata:
testdata/ go.mod.test a/a.go b/b.go
The resulting files will be:
dst/ go.mod a/a.go b/b.go
func ExtractTxtar ¶
ExtractTxtar writes each archive file to the corresponding location beneath dir.
TODO(adonovan): move this to txtar package, we need it all the time (#61386).
func ExtractTxtarFileToTmp ¶
ExtractTxtarFileToTmp read a txtar archive on a given path, extracts it to a temporary directory, and returns the temporary directory.
Types ¶
This section is empty.