You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some concerns regarding this commit. While the changes to the assert.Same() function seem appropriate for pointer comparisons, they are not suitable for comparing maps. In my case, it has become impossible to compare a map with its cloned copy.
If this change is considered appropriate, I believe there should be a separate function specifically for comparing pointer-like objects.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
This is also an issue for me. We have many tests that are verifying cloning of maps, and those tests now fail with this error. This feels like a breaking change.
After testing things out, it seems like NotSame was not testing what we thought it was. (The below is using the previous version v1.9.0)
funcTestSameMap(t*testing.T) {
a:=map[string]string{"z": "z"}
b:=map[string]string{"z": "z"}
// succeedsassert.Equal(t, a, b)
// Both of these succeedassert.NotSame(t, a, a)
assert.NotSame(t, a, b)
// Both of these failassert.Same(t, a, a)
assert.Same(t, a, b)
}
Interestingly, assert.Same(t, a, a) fails with the following error
Error: Not same:
expected: 0x14000108f30 map[string]string{"z":"z"}
actual : 0x14000108f30 map[string]string{"z":"z"}
I would hope this function would work with maps though.
Hello everyone,
I’d like to ask a quick question informally.
118fb83#diff-cfb0727d3ab618e656775b3bb99089481b38a25f8ece2b10913e2d88e492a165R531
I have some concerns regarding this commit. While the changes to the assert.Same() function seem appropriate for pointer comparisons, they are not suitable for comparing maps. In my case, it has become impossible to compare a map with its cloned copy.
If this change is considered appropriate, I believe there should be a separate function specifically for comparing pointer-like objects.
Thanks in advance.
The text was updated successfully, but these errors were encountered: