Documentation
¶
Overview ¶
Package testutil holds the fixture helpers the package tests share: the repo root (for tests that read the checked-in tree), the mkdir-then-write fixture writer, the drift gate (drift.go) and the golden compare with its -update rewrite. Test-only by convention: nothing outside *_test.go imports it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Golden ¶
Golden compares got with the golden file at path. With update set it rewrites the file with got instead and reports nothing. The message names the command that rewrites the golden.
Types ¶
type Drift ¶
type Drift struct {
// Want is the canonical side. Got is the twin that must match it.
Want, Got Tree
// Sync names the command that brings Got in line with Want. It is
// printed with every difference.
Sync string
// SyncBack names the command that brings Want in line with Got. It is
// printed for an entry that exists only in Got. Empty means Sync.
SyncBack string
// Subset makes an entry that exists only in Got a non-difference.
Subset bool
// Max caps the number of differences reported. Zero means 20.
Max int
}
Drift compares two Trees and fails the test on every difference.
type Tree ¶
Tree is one side of a drift comparison: a name for the messages and the entries it holds. A key is a slash-separated relative path (or any other identifier, such as a module path); a value is the content to compare.