Skip to content

Should assert.output("text") trim / normalize line endings? #19

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

Closed
epage opened this issue Jun 23, 2018 · 5 comments
Closed

Should assert.output("text") trim / normalize line endings? #19

epage opened this issue Jun 23, 2018 · 5 comments
Labels
breaking-change question Uncertainty is involved

Comments

@epage
Copy link
Contributor

epage commented Jun 23, 2018

Right now, str gets turned into a Utf8<Difference> set of predicates. Should we add trimming and line ending normalization to that?

assert_cli did trimming. This would allow people to work around it by directly passing in a predicate rather than relying on IntoOutputPredicate.

@epage epage added question Uncertainty is involved breaking-change labels Jun 23, 2018
@epage
Copy link
Contributor Author

epage commented Jun 23, 2018

Related: assert-rs/assert_cli#77

@mssun
Copy link
Contributor

mssun commented Jul 21, 2018

I don't think auto/explicitly trimming will help a lot. I think the current behavior is very intuitive. I expect this API will compare the output exactly byte by byte.

@zetok
Copy link

zetok commented Jul 24, 2018

Rather than breaking current intuitive behaviour of the function, why not add another function for the functionality, something like output_trimmed or output_fuzzy?

@epage
Copy link
Contributor Author

epage commented Jul 25, 2018

The reason this question even came up is that trimming was the default behavior of assert_cli and as of right now assert_cmd does not mirror that.

Rather than breaking current intuitive behaviour of the function, why not add another function for the functionality, something like output_trimmed or output_fuzzy?

Unlike assert_cli, I'm trying to not add a lot of variants of the assert functions but instead rely on users creating custom predicates. We happen to be providing shortcuts for some common cases instead of requiring the full predicate to be spelled out.

@epage
Copy link
Contributor Author

epage commented Jul 30, 2018

Going to go ahead and say "no" due to principle of least surprise

@epage epage closed this as completed Jul 30, 2018
epage added a commit to epage/assert_cmd that referenced this issue Apr 1, 2024
chore(ci): Ensure CI job always runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change question Uncertainty is involved
Projects
None yet
Development

No branches or pull requests

3 participants