func Ignore() TestDeep
Ignore
operator is always true, whatever data is. It is useful when
comparing a slice with Slice
and wanting to ignore some indexes,
for example. Or comparing a struct with SStruct
and wanting to
ignore some fields:
td.Cmp(t, td.SStruct(
Person{
Name: "John Doe",
},
td.StructFields{
Age: td.Between(40, 45),
Children: td.Ignore(),
}),
)
See also Ignore godoc.
t := &testing.T{}
ok := td.Cmp(t, []int{1, 2, 3},
td.Slice([]int{}, td.ArrayEntries{
0: 1,
1: td.Ignore(), // do not care about this entry
2: 3,
}))
fmt.Println(ok)
// Output:
// true