-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
There's no flag to allow assert_eq to format as multi-line results #80787
Copy link
Copy link
Open
Labels
A-error-handlingArea: Error handlingArea: Error handlingA-fmtArea: `core::fmt`Area: `core::fmt`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-error-handlingArea: Error handlingArea: Error handlingA-fmtArea: `core::fmt`Area: `core::fmt`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I think this is a
bug, rather than a feature request, but maybe others will disagree - it certainly feels like a UX missed opportunitiy.Looking at the
assert_eqcode, we always debug format on one line despite us having the ability to nicely format as multi-line.https://doc.rust-lang.org/src/core/macros/mod.rs.html#48-49
Given that IDEs like intellirust have really nice diff viewers to show the difference between expected and actual it would be great if a flag could be set to allow expected and actual to be printed using the mutliline debug formatter.
(I've shown how TeamCity can show similar test output diffs on their website using a crate I rolled called
cargo-service-message)It's a small change but it would greatly improve the usability in more complex situations. I would keep single line as default, but having a multiline option would really improve test reporting.
Ultimately nothing building on top can do anything nice unless we find a way to format as {:#?}, so we really need to find a way to enable this as an option.