The following test cases succeeds somewhat surprisingly:
func TestNotDeepEquals(t *testing.T) {
type a struct {
v int
}
v1 := a{1}
qt.Assert(t, v1, qt.Not(qt.DeepEquals), v1)
}
Dropping the Not reveals that go-cmp actually returned an error:
error:
cannot handle unexported field at {testutils.a}.v:
"github.com/cilium/ebpf/internal/testutils".a
consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported
got:
testutils.a{v:1}
want:
<same as "got">
stack:
/home/lorenz/dev/ebpf/internal/testutils/cmp_test.go:15
qt.Assert(t, v1, qt.DeepEquals, v1)
Seems like Not treats an error from the checker which means "wasn't able to compare" the same as "not equal".
The following test cases succeeds somewhat surprisingly:
Dropping the
Not
reveals that go-cmp actually returned an error:Seems like
Not
treats an error from the checker which means "wasn't able to compare" the same as "not equal".