-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Pretty formating #10068
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
Reflection is going to removed. What could be done for this? |
Seems reasonable to leave it open, as we'd presumably want the same thing for |
This issue will soon be one year old. Meanwhile, |
Visiting after the |
It would be helpful for debugging to have a string formatting "style" that is for
"{:?}"
whatextra::json::Json::to_pretty_str
is toextra::json::Json::to_str
. That is, it does the same (uses introspection to dump the content of various data structures) but adds newlines and indentation as appropriate for readability.This pretty formatting would be used by
assert_eq!()
.For example, I am writing tests like this for Selector parsing in Servo:
At the moment, a failing test gives this output:
Not exactly easy to read. Ideally, the output should be closer to this:
See also Python’s
pprint
module: http://docs.python.org/3/library/pprint.htmlhttp://hg.python.org/cpython/file/3.3/Lib/pprint.py
The text was updated successfully, but these errors were encountered: