Package opt provides common go-cmp.Options for use with assert.DeepEqual.
Package Files ¶
func DurationWithThreshold ¶
DurationWithThreshold returns a gocmp.Comparer for comparing time.Duration. The Comparer returns true if the difference between the two Duration values is within the threshold and neither value is zero.
PathDebug is a gocmp.FilerPath filter that always returns false. It prints each path it receives. It can be used to debug path matching problems.
PathField is a gocmp.FilerPath filter that matches a struct field by name. PathField will match every instance of the field in a recursive or nested structure.
func PathString ¶
PathString is a gocmp.FilterPath filter that returns true when path.String() matches any of the specs.
The path spec is a dot separated string where each segment is a field name. Slices, Arrays, and Maps are always matched against every element in the sequence. gocmp.Indirect, gocmp.Transform, and gocmp.TypeAssertion are always ignored.
Note: this path filter is not type safe. Incorrect paths will be silently ignored. Consider using a type safe path filter for more complex paths.