Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Formats ¶
Formats is an alias for function signature that reads from reader, formats it and writes to writer.
type Gold ¶
type Gold struct {
// contains filtered or unexported fields
}
Gold makes assertions against golden files.
func (*Gold) AssertEquals ¶
AssertEquals compares a string to the contents of the golden file. If Gold was configured with an update flag which is true then the golden file will be created if it does not exist or overwritten with the supplied data if it does.
func (*Gold) AssertEqualsHTML ¶
AssertEqualsHTML compares an HTML string to the golden file. Data is noramlized before comparing so data which is formatted differently but semantically equivalent will not fail.
func (*Gold) AssertEqualsJSON ¶
AssertEqualsJSON compares a JSON string to the golden file. Data is noramlized before comparing so data which is formatted differently but semantically equivalent will not fail.
func (*Gold) AssertEqualsTOML ¶
AssertEqualsTOML compares a TOML string to the golden file. Data is noramlized before comparing so data which is formatted differently but semantically equivalent will not fail.
func (*Gold) AssertEqualsYAML ¶
AssertEqualsYAML compares a YAML string to the golden file. Data is noramlized before comparing so data which is formatted differently but semantically equivalent will not fail.
type Option ¶
type Option func(g *Gold)
Option is the signature for functions that configure Gold.
func WithFailAfter ¶
func WithFailAfter() Option
WithFailAfter configures whether to stop test execution upon failure.
func WithPrefix ¶
WithPrefix sets the folder prefix for golden files.
type Testing ¶
type Testing interface { Cleanup(func()) Error(args ...any) Errorf(format string, args ...any) Fail() FailNow() Failed() bool Fatal(args ...any) Fatalf(format string, args ...any) Helper() Log(args ...any) Logf(format string, args ...any) Name() string Setenv(key, value string) Skip(args ...any) SkipNow() Skipf(format string, args ...any) Skipped() bool TempDir() string }
Testing is a subset of testing.TB that can be reimplemented.