Documentation
¶
Index ¶
- func Assert(t testing.TB, actual image.Image)
- func Fail(t testing.TB, actual image.Image)
- func Test(t testing.TB, actual image.Image) error
- type DiffFiles
- type ErrBoundsMismatch
- type ErrPixelsDiffer
- type Option
- type Snapshots
- func (s *Snapshots) Assert(t testing.TB, actual image.Image)
- func (s *Snapshots) AssertWithName(t testing.TB, name string, actual image.Image)
- func (s *Snapshots) Cleanup()
- func (s *Snapshots) Fail(t testing.TB, actual image.Image)
- func (s *Snapshots) FailWithName(t testing.TB, name string, actual image.Image)
- func (s *Snapshots) Test(t testing.TB, actual image.Image) error
- func (s *Snapshots) TestWithName(t testing.TB, name string, actual image.Image) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DiffFiles ¶
type DiffFiles struct {
// contains filtered or unexported fields
}
func (DiffFiles) ActualPath ¶
func (DiffFiles) CompositePath ¶
type ErrBoundsMismatch ¶
type ErrBoundsMismatch struct {
DiffFiles
// contains filtered or unexported fields
}
func (ErrBoundsMismatch) Error ¶
func (e ErrBoundsMismatch) Error() string
type ErrPixelsDiffer ¶
type ErrPixelsDiffer struct {
DiffFiles
// contains filtered or unexported fields
}
func (ErrPixelsDiffer) Error ¶
func (e ErrPixelsDiffer) Error() string
type Option ¶
type Option func(*Snapshots)
func WithDiffColor ¶
func WithStorageRoot ¶
func WithTempDir ¶
type Snapshots ¶
type Snapshots struct {
// contains filtered or unexported fields
}
func (*Snapshots) Assert ¶
Assert that the provided image matches the snapshot. Cause a test error if not.
func (*Snapshots) AssertWithName ¶
Assert that the provided image matches the named snapshot. Cause a test error if not.
func (*Snapshots) Cleanup ¶
func (s *Snapshots) Cleanup()
Remove all of the temporary files created by this instance.
func (*Snapshots) FailWithName ¶
Assert that the provided image matches the named snapshot. Fail the test if not.
func (*Snapshots) Test ¶
Test compares the actual image to the snapshot image. If the snapshot image does not exist, it will be created. If the images differ, an error is returned, either ErrBoundsMismatch or ErrPixelsDiffer. The error can be inspected to get the paths to the actual and composite diff images. A non-test failure will cause `testing.TB.Fatal()` to be called.