Open sb10 opened 2 years ago
After a bit of debugging, it looks like when you defer to reflect.DeepEqual
, it's returning false. So not your "fault", but the message returned is confusing.
Why isn't ShouldResemble
implemented by doing something like:
renderedExpected, renderedActual := render.Render(expected[0]), render.Render(actual)
if renderedExpected != renderedActual {
...
}
I just encountered what I think is the same issue. It happens when two different int types are compared.
func TestSillyDiff(t *testing.T) {
type value struct {
v any
}
v1 := value{int(123)}
v2 := value{int64(123)}
Convey("These things ain't the same", t, func() {
// this passes
So(reflect.DeepEqual(v1, v2), ShouldBeFalse)
// this fails, see message below this block
So(v1, ShouldResemble, v2)
})
}
the above prints something like this, which is technically true, but the diff is useless
Line 28:
Expected: 'pkg.value{v:123}'
Actual: 'pkg.value{v:123}'
(Should resemble)!
Diff: 'pkg.value{v:123}'
Using go 1.19 (also happened with go 1.18) and goconvey v1.7.2 both locally and in a GitHub action, my tests pass locally but fail in GitHub:
https://github.com/wtsi-ssg/wrstat/runs/7804713143?check_suite_focus=true
You will note that the "Expected" and "Actual" strings that it prints out are actually identical.
Why would this be happening, and what can I do about it?