Open
Description
I try to test some properties of zap log and I got this:
assert.Same(t, zapcore.ISO8601TimeEncoder, got.EncoderConfig.EncodeTime)
Error: Not same:
expected: 0x6bb840 (func(time.Time, zapcore.PrimitiveArrayEncoder))(0x6bb840)
actual : 0x6bb840 (zapcore.TimeEncoder)(0x6bb840)
In this test the object types are different, but the pointer (address) are same.
Internally the function Same
call function samePointers
, but this function compare two object pointers and not if the address of each object are equal.
Line 409 in 6241f9a
For me its ok this behavior, but I propose a new assert, something like assert.SameAddress(t TestingT, referenceObject, actualObject interface{})
This new assert just check if de uintptr
is the same value of referenceObject and actualObject using the function reflect.ValueOf(i interface{}).Pointer()
Metadata
Metadata
Assignees
Labels
No labels