Skip to content

Add further assertion to test, as suggested by Mingun #491

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

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

ExplodingCabbage
Copy link
Collaborator

When I added this test, I decided to modify the assertion it makes to be easier to understand and verify the correctness of at a glance, at the expense of making it a less robust test of the behaviour. @Mingun indicated his disagreement with this at #488 (comment) and I immediately agreed he had a point, so I've added the more rigorous assertion back in alongside the readable one.

Interestingly, just directly copying @Mingun's assertion failed; @Mingun's version ends with:

        '<del>]</del><ins>  ]\n',
        '}</ins>'

but with my version of the ignoreWhitespace code, the line with the ] on it isn't treated as deleted and re-inserted at all, simply as equal/preserved. I guess this is a difference in how @Mingun's logic from #219 and mine from #486 handle the case where in one text a line is the final line and doesn't have a trailing newline character. I prefer the way my code seems to handle this (i.e. ignoring the addition of a trailing newline to a line that didn't have it), so I'm glad we've got a test for it now!

Thanks again to @Mingun for nudging me into doing things better. 😄

@ExplodingCabbage ExplodingCabbage merged commit a73b771 into master Feb 16, 2024
@ExplodingCabbage ExplodingCabbage deleted the further-tweak-mingun-tests branch February 16, 2024 10:58
@Mingun
Copy link
Contributor

Mingun commented Feb 16, 2024

I prefer the way my code seems to handle this (i.e. ignoring the addition of a trailing newline to a line that didn't have it), so I'm glad we've got a test for it now!

Yes, I also agree with that.

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

Successfully merging this pull request may close these issues.

2 participants