Documentation
¶
Overview ¶
Package fixtures builds the artifact test fixtures described by the artifact validation plan ("File package" and "Invalid package") with Go code inside a caller-supplied temporary directory. It never shells out, so it behaves identically on every platform.
Index ¶
- Constants
- func FilePackagePaths(symlinks bool) []string
- func MkdirAll(t testing.TB, dir, rel string)
- func POSIXModes() bool
- func RequirePOSIXModes(t testing.TB)
- func SpecialFile(t testing.TB, dir, rel string) bool
- func Symlink(t testing.TB, dir, rel, target string) bool
- func WriteFile(t testing.TB, dir, rel string, content string, mode fs.FileMode)
- type FilePackage
Constants ¶
const ( // RootReadme is the content of the root README.md, which stays ordinary payload. RootReadme = "# Root readme\n" // PackageReadme is the content of the distribution README in the reserved directory. PackageReadme = "# Package readme\n" // PackageChangelog is the content of the distribution CHANGELOG in the reserved directory. PackageChangelog = "# Changelog\n\n- first\n" // HelperScript is the content of the executable helper. HelperScript = "#!/bin/sh\necho helper\n" // UnicodeName is the Unicode filename in the file package. UnicodeName = "unicode-é-日本.txt" // ReservedDir is the reserved distribution directory below the source root. ReservedDir = ".atmos/artifact" )
Well-known fixture content.
Variables ¶
This section is empty.
Functions ¶
func FilePackagePaths ¶
FilePackagePaths lists the inventory paths of the file package in sorted order, excluding the reserved distribution directory and, when symlinks are unavailable, the symlink.
func POSIXModes ¶
func POSIXModes() bool
POSIXModes reports whether the platform honors Unix permission bits. Windows does not, so tests that assert executable bits or mode-only changes skip there.
func RequirePOSIXModes ¶
RequirePOSIXModes skips the test on platforms that ignore Unix permission bits.
func SpecialFile ¶
SpecialFile creates a named pipe (a special file) at rel below dir and reports whether it could.
Types ¶
type FilePackage ¶
type FilePackage struct {
// Dir is the source directory.
Dir string
// Symlinks reports whether the confined symlink could be created.
Symlinks bool
}
FilePackage describes the files written by WriteFilePackage.
func WriteFilePackage ¶
func WriteFilePackage(t testing.TB, dir string) FilePackage
WriteFilePackage writes the valid "File package" fixture into dir: nested files, an executable helper, an empty file, an empty directory, a confined symlink, a Unicode filename, a root README (ordinary payload), and a distinct package README and CHANGELOG in the reserved directory.