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

fix: deleted trailing newline causes panic #97

Merged
merged 1 commit into from Apr 2, 2022

Conversation

tommilligan
Copy link
Collaborator

@tommilligan tommilligan commented Apr 2, 2022

Closes #96

Turns out that we had assumed an invariant from the underlying diff library that does not, in fact, exist. We can receive an insertion followed by a deletion in the case where a trailing newline is deleted - for some reason the trailing newline deletion is not grouped with the previous deletion, and instead follows after the insertion on its own, despite there being no plain text in the middle.

It's a slightly odd looking diff, but I think it makes sense and is not worth special casing further. It's handled nicely by just removing our invariant check and letting the existing logic handle it.

image

@tommilligan tommilligan self-assigned this Apr 2, 2022
@tommilligan tommilligan merged commit ae6cc15 into rust-pretty-assertions:main Apr 2, 2022
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.

Abort due to double-panic
1 participant