Top 1.8% dependent packages on proxy.golang.org
Top 2.5% dependent repos on proxy.golang.org
proxy.golang.org : github.com/jimeh/go-golden
Package golden is yet another package for working with *.golden test files, with a focus on simplicity through it's default behavior. Golden file names are based on the name of the test function and any sub-test names by calling t.Name(). File names are sanitized to ensure they're compatible with Linux, macOS and Windows systems regardless of what crazy characters might be in a sub-test's name. Typical usage should look something like this: The above example will read/write to: The call to golden.Do() is equivalent to: To update the golden file (have golden.Update() return true), simply set the GOLDEN_UPDATE environment variable to one of "1", "y", "t", "yes", "on", or "true" when running tests. As the golden filename is based on t.Name(), it works with sub-tests too, ensuring each sub-test gets its own golden file. For example: The above example will read/write to: The "P" suffixed methods, GetP(), SetP(), and FileP(), all take a name argument which allows using specific golden files within a given *testing.T instance. The above example will read/write to: This works with tabular tests too of course: The above example will read/write to:
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/jimeh/go-golden
Keywords:
go
, go-golden
, go-test
, go-test-helper
, go-testing
, golang
, golden-file
License: MIT
Latest release: about 2 months ago
First release: over 3 years ago
Namespace: github.com/jimeh
Dependent packages: 9
Dependent repositories: 4
Stars: 6 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 21 days ago