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

Trailing whitespace in testcases is ignored for diffs #384

Open
TheNeikos opened this issue Jun 16, 2023 · 5 comments
Open

Trailing whitespace in testcases is ignored for diffs #384

TheNeikos opened this issue Jun 16, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@TheNeikos
Copy link

What happened?

I created test snapshots with excessive newlines. This was then corrected later, but there was no error or reported diff due to the now missing newlines at the end.

Reproduction steps

  1. assert a snapshot with a lot of newlines at the end
  2. update the value and remove the newlines
  3. no error/diff is reported

Insta Version

1.29

rustc Version

1.70

What did you expect?

I expected newlines changes to be reported, as this is for a CLI application, the trailing whitespaces are important.

@TheNeikos TheNeikos added the bug Something isn't working label Jun 16, 2023
@mitsuhiko
Copy link
Owner

That's unfortunately a limitation. I think one way to work with this would be to have users that need whitespace handling to add markers around it that make this more explicit.

@mitsuhiko mitsuhiko added enhancement New feature or request and removed bug Something isn't working labels Jun 16, 2023
@TheNeikos
Copy link
Author

Why is it a Limitation if you don’t mind me asking?

@mitsuhiko
Copy link
Owner

@TheNeikos it's a natural effect of how the indentation clean up system functions.

@TheNeikos
Copy link
Author

@TheNeikos it's a natural effect of how the indentation clean up system functions.

Hm, since the newlines in this case are trailing, why would indentation (which usually comes before non-whitespace characters) interact with those?

@mitsuhiko
Copy link
Owner

The code that cleans up indentation cannot disambiguate these cases.

Sec-ant added a commit to Sec-ant/biome that referenced this issue Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants