Skip to content

Comparing sequences fails #221

Closed
Closed
@abelbraaksma

Description

@abelbraaksma

Description

The following fails:

Seq.init 100 ((+) 1)
|> should equal (Seq.init 100 ((+) 1))

Repro steps

See above.

Expected behavior

Should succeed.

Actual behavior

Gives test error:

FsUnit.Xunit+MatchException : Exception of type 'FsUnit.Xunit+MatchException' was thrown.
Expected: Equals seq [1; 2; 3; 4; ...]
Actual:   seq [1; 2; 3; 4; ...]

Which is rather confusing as it doesn't show where the two sequences diverge (spoiler alert: they don't ;) ).

Known workarounds

A workaround is to not use sequences in tests

I.e.: turning them into eager collections works fine:

Seq.init 100 ((+) 1)
|> Array.ofSeq
|> should equal (Seq.init 100 ((+) 1) |> Array.ofSeq)

Related information

Version 5.0.5
Using: FsUnit.Xunit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions