Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing lists for equality gives unpleasant failure report #266

Open
snuup opened this issue Feb 23, 2024 · 4 comments
Open

Testing lists for equality gives unpleasant failure report #266

snuup opened this issue Feb 23, 2024 · 4 comments
Assignees

Comments

@snuup
Copy link

snuup commented Feb 23, 2024

[ 77 ] |> shouldEqual [ 99 ]

reports the failure

Unhandled exception. NUnit.Framework.AssertionException: Assert.That(, )
Expected: < 99 > or < 99 >
But was: < 77 >

This is caused by this tricky code in Equality.fs:

static member inline IsEqualTo(x: 'T) =
    match (box x) with
    | :? IStructuralEquatable -> Is.EqualTo(x).Or.EqualTo(x).Using<'T>(Equality.Structural)
    | :? IStructuralComparable -> Is.EqualTo(x).Or.EqualTo(x).Using<'T>(Equality.StructuralC)
    | _ -> Is.EqualTo(x)

(I did not succeed fixing this, removing the Or constraints leads to no detailed list comparison.)

@CaptnCodr
Copy link
Member

Hi @snuup,
I'm looking into it.

@CaptnCodr
Copy link
Member

Hi @snuup,
I found out that this is the most precise code regarding the failure message.
The message blocks changed slightly since NUnit v4.

@CaptnCodr CaptnCodr self-assigned this Mar 7, 2024
@snuup
Copy link
Author

snuup commented Mar 9, 2024

Thx for your efforts.
From a user perspective the message is irritating. Certainly not a show stopper, more a somewhat serious cosmetic issue.

@CaptnCodr
Copy link
Member

Yea, I let this open here. Perhaps, someone/I find a way to change this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants