Closed haf closed 10 years ago
One some level though, if F# and the CLR doesn't do think they are equal, why should the test framework. Perhaps this is more of a F# problem, so if you want you can close this issue.
Yeah, equality for ArraySegment seems to be broken. More concretely, its structural equality seems to be derived from its condition as struct, and so it probably checks for offset and count to be equal. An example:
let a = ArraySegment<byte>([|2uy; 3uy|], 0, 1)
let b = ArraySegment<byte>([|2uy|])
Assert.Equal("ArraySegments are equal", a, b)
fails with:
ArraySegments are equal
Expected: seq [2uy]
Actual: seq [2uy]
Overall, equality in .NET is quite broken and unnecessarily complex (F# is no exception). If you use Seq.toArray
for both sides of the assertion it should work as expected.
I have some code that creates a test case:
Getting failure like this:
Structure: