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

Report mismatch segment for strings of unequal lengths #915

Conversation

@krajek
Copy link
Contributor

krajek commented Sep 16, 2018

Proposal to fix #907.

I used the same mechanism to display differences as in part of the code that handles strings with equal lengths, with few adjustments.

BTW Possible follow-ups:

  • "lazy" version of FailWith, that delays the calculation of message and its params
  • display differences improvement reporting line within the text when the first difference occurs, maybe only for multiline subjects
@dennisdoomen

This comment has been minimized.

Copy link
Member

dennisdoomen commented Sep 17, 2018

Are you still working on this? If so, please prefix it it with [WIP]

@krajek krajek changed the title Report mismatch segment for strings of unequal lengths [WIP] Report mismatch segment for strings of unequal lengths Sep 17, 2018
@krajek

This comment has been minimized.

Copy link
Contributor Author

krajek commented Sep 17, 2018

I think I am done with the first proposition.
What do you think about the idea of putting a mismatching segment in the assertion message and about this particular implementation?

@krajek krajek changed the title [WIP] Report mismatch segment for strings of unequal lengths Report mismatch segment for strings of unequal lengths Sep 17, 2018
Copy link
Member

dennisdoomen left a comment

Only minor comments. Check the legend for the meaning of the emojis.

int indexOfMismatch = subject.IndexOfFirstMismatch(expected, comparisonMode);

// If there is no difference it means that subject and expected have common prefix
// and the first difference is after just that prefix.

This comment has been minimized.

Copy link
@dennisdoomen

dennisdoomen Sep 17, 2018

Member

What do you mean with prefix here?

@dennisdoomen dennisdoomen requested a review from jnyrup Sep 19, 2018
@dennisdoomen

This comment has been minimized.

Copy link
Member

dennisdoomen commented Sep 19, 2018

@krajek can we merge this?

@krajek

This comment has been minimized.

Copy link
Contributor Author

krajek commented Sep 19, 2018

Yes, please. Thanks for the reviews.
After this one is merged I will try to follow up will lazy FailWith and refactor accordingly.

@dennisdoomen dennisdoomen merged commit c6e72d6 into fluentassertions:master Sep 20, 2018
1 check passed
1 check passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@dennisdoomen

This comment has been minimized.

Copy link
Member

dennisdoomen commented Sep 20, 2018

Awesome. Thanks man.

@krajek krajek deleted the krajek:location_of_difference_for_strings_with_different_length branch Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.