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 CopyToTmp ¶
CopyToTmp copies the files and directories in src to a new temporary testing directory dst, and returns dst on success.
After copying the files, it processes each of the 'old,new,' rename directives in order. Each rename directive moves the relative path "old" to the relative path "new" within the directory.
Renaming 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
with the rename "go.mod.test,go.mod", the resulting files will be:
dst/ go.mod a/a.go b/b.go
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.