Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
Diff compares expected and got recursively and returns a human-readable report of their differences, or the empty string if they are equal. Each difference is reported as the path to the differing value followed by the expected (-) and got (+) values.
Values whose type has a method of the form Equal(T) bool are compared with that method. Comparing unexported struct fields or non-nil function values panics; skip them with IgnoreFields or compare a containing type with a Comparer option or an Equal method.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures how Diff and CompareErr compare values.
func Comparer ¶
Comparer returns an Option that compares values with function, which must have the form func(T, T) bool. It applies wherever both compared values are assignable to T, taking precedence over any Equal method and the built-in comparison. It panics if function does not have the required form.
func EquateEmpty ¶
func EquateEmpty() Option
EquateEmpty returns an Option that treats nil slices and maps as equal to empty ones.
func IgnoreFields ¶
IgnoreFields returns an Option that skips the named fields of the struct type of structValue during comparison. It panics if structValue is not a struct or a pointer to one, or if a name does not match a field.