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

Output multi-line string literals inside nested objects. #128

Open
coolbluewater opened this issue Mar 23, 2024 · 2 comments
Open

Output multi-line string literals inside nested objects. #128

coolbluewater opened this issue Mar 23, 2024 · 2 comments

Comments

@coolbluewater
Copy link

Asserting on top-level structs that contain a data hierarchy works and is very useful.
However, strings are always output as single line strings and I could not find a way to have them output as multi line string literals.
It isn't possible to use assert_str_eq because the struct can't easily implement AsRef.

Any guidance on how to do this, or is this a feature request?

@tommilligan
Copy link
Collaborator

Agreed this is not currently possible with pretty_assertions. At the moment the Debug representation is used, which for strings is a single line.

I can imagine that this is something that we could implement in the printer layer, but I'm not sure what heuristic you'd want to use for wrapping. You'd also want this to be configurable, and there is open discussion around making the diff output configurable here: #116

@coolbluewater
Copy link
Author

coolbluewater commented Mar 27, 2024

@tommilligan, I don't need any wrapping myself, just breaking on newlines is fine. That's also what text editors do by default for raw rust string literals.

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

No branches or pull requests

2 participants