franela / goblin

Minimal and Beautiful Go testing framework
MIT License
887 stars 79 forks source link

0 not equal 0x0 #71

Closed askovpen closed 4 years ago

askovpen commented 6 years ago

fail: g.Assert(bufHash32("")).Equal(0x0)

pass: g.Assert(bufHash32("")).Equal(uint32(0x0))

plz add ability to use "0x%x" format. and view result in same format.

Neirpyc commented 4 years ago

I think it is not a problem of 0x%x notation, but rather that 0x0 is of type int and uint32(0x0) of type uint32. Two objects with the same value but not the same type are different. It works the same way as 0 != nil.