-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking issue for RFC 1866: More readable assert_eq #41615
Comments
small side-note: In case anyone wants to use this before it is stabilized, I just implemented multiline display in |
Btw. red and green aren't maybe the best choices for colour coding, as the red-green colour blindness is the most common type of vision deficiency out there. (The coloured pieces would still stand out from the normal text if I understand red-green-colour blindness correctly, but not from each others.) |
The quick brown [-duck-]{+fox+} jumps over the lazy dog Where |
assert_eq failure message easier to read By having the left and right strings aligned with one another it helps spot the difference between the two far quicker than if they are on the same line. E.g. Before: ``` thread 'tests::test_safe_filename' panicked at 'assertion failed: `(left == right)` left: `"-aandb--S123.html"` right: `"-aandb-S123.html"`', ``` After: ``` thread 'tests::test_safe_filename' panicked at 'assertion failed: `(left == right)` left: `"-aandb--S123.html"` right: `"-aandb-S123.html"`', ``` When the strings are both on the same line it take a lot longer to spot the difference. It is a small change but the small time savings add up with repetition. This would help Rust be an excellent language to write tests in out of the box. Closes #41615
Is this tracking issue supposed to be closed? |
Thanks @ordovicia. I've reopened the issue since there are still two unresolved questions (color and arrow). However AFAIK there can be no "Stabilization PR", the change is insta-stable. For "Adjust documentation", perhaps check the books if the output format needs to be updated, but otherwise no specific documentation is needed for this feature. |
That does not look like the complete implementation. If it is, then this issue can probably be closed since this has been the stable output since over 2 years now. |
I just re-read the RFC and this is indeed fully implemented. I do not think there's anything left to document/stabilize, and there's also #44838 tracking further improvements to assertion error messages, so closing. |
assert_eq failure message easier to read By having the left and right strings aligned with one another it helps spot the difference between the two far quicker than if they are on the same line. E.g. Before: ``` thread 'tests::test_safe_filename' panicked at 'assertion failed: `(left == right)` left: `"-aandb--S123.html"` right: `"-aandb-S123.html"`', ``` After: ``` thread 'tests::test_safe_filename' panicked at 'assertion failed: `(left == right)` left: `"-aandb--S123.html"` right: `"-aandb-S123.html"`', ``` When the strings are both on the same line it take a lot longer to spot the difference. It is a small change but the small time savings add up with repetition. This would help Rust be an excellent language to write tests in out of the box. Closes rust-lang/rust#41615
This is a tracking issue for the RFC "More readable assert_eq" (rust-lang/rfcs#1866).
Steps:
Unresolved questions:
assert_ne
?The text was updated successfully, but these errors were encountered: