-
Notifications
You must be signed in to change notification settings - Fork 25
Option to not to normalize backslash #91
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
Comments
The main question with this is deciding how to expose it. |
It'd be great if it is exposed via let t = trycmd::TestCases::new()
t.output_normalize_path(false); // default: true (for compatibility)
t.output_normalize_line_separator(true); // default: true and maybe per-test override via toml configuration output_normalize_path = false
output_normalize_line_separator = true though I guess it'll be a bit cumbersome to handle conflict with |
Is there a reason you'd want to offer control over line normalization instead of just associating that with
I'd just ignore or error if btw I've been forgetting to write this up but #93 might also be useful |
Since I still want line separators to be normalized...
Yeah that sounds reasonable.
That'd be a great feature. But in my case, I want to verify not just as a json but some other things, like if it is properly indented and if the order of object entries are kept. |
More so I was wondering is if Granted, I don't remember if we strip BOMs but that might be the most basic
Yes, I want to keep this in mind and give people control over that. Could you post that to the issue both so its explicitly recorded and so you'll be subscribed so you can make sure the solution for opting out is acceptable? |
Ah sorry, I see what you meant now. Making
|
Another solution would be to compare ouputs before normalization, and only normalize if the ouputs do not already matches (optimally even only normalise if it detects the failure is due to missing normalisation, but haven’t checked source code see if possible) |
iirc I had considered that at one point but the challenge is it doesn't scale to different normalization options. Originally when I considered this, I was also wondering about the different replacement patterns supported, etc. |
This handles the snapbox side of assert-rs#91. We'll need to update the plumbing in trycmd to get this to all the right places. For now this also lets us experiment with it where we can more easily change the API.
This handles the snapbox side of assert-rs#91. We'll need to update the plumbing in trycmd to get this to all the right places. For now this also lets us experiment with it where we can more easily change the API. We still normalize paths when inserting substitions. The two APIs aren't connected at the moment to allow fixing this. This will need more consideration.
I noticed that this fails due to "backslash to slash normalization".
It is probably useful for things that outputs paths, but is cumbersome for other things, e.g. a tool that outputs JSON, as test has to be
stdout = '"/"escaped/""'
for example instead ofstdout = '"\"escaped\""'
, and there's no way to check if the output was actually correctly escaped with\
.I know that there's a bin mode, but I still want line separators normalized. It'd be great to have a way to turn off the path separator normalization feature.
The text was updated successfully, but these errors were encountered: