Skip to content

Assert on string should show at least the first difference. #4261

@nohwnd

Description

@nohwnd

Special case the AreEqual when the type is string and show at least the first diff of the string. Compare the mstest vs nunit vs xunit experience.

mstest
Image

nunit
Image

xunit
Image

advantages of nunit are that it uses ascii only characters, so we won't run into issues with the console not being utf8 #2491

A longer input should consider the size of the screen and select appropriate amount of characters, preferring the context before the diff, rather than putting them 50:50 or at the beginning. (at least this is my experience from Pester, where we changed the approach quite a lot)

For contexts where we don't know the output size we should select a reasonable minimum,

Image

Prefer showing the texts even when the sizes of the strings vary.

Image

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions