-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Smart asserts #2367
Comments
This would be great. And maybe a good (re-)starter project for an intern (where's the "E-intern" label?) |
Or it could print out a stack trace showing the values of all the locals. |
I'd expect this as part of the 'note' facility, if we ever implement that independently. Or if we do it in a library, then a form of assert packaged as a syntax extension that adds notes (or note-objects, whatever their equivalent is) for each subexpression in its condition. |
Python has a library for this. Here is a demo, which is rather impressive: http://pytest.org/latest/example/reportingdemo.html |
Nominating for production ready. |
accepted for far-future. (jclements asserted this is harder than you might think, and we agreed.) |
ah, I was unaware that was a milestone things could be nominated for. makes sense :p |
Triage: this is presumably still hard, but we now have the possibility of |
No change. |
Triage bump. No change. |
Triage bump. No change.
|
We now have two independent implementations: gifnksm/power-assert-rs and manuel-woelker/rust-passert. Both unconditionally stringifies subexpressions before the conditional however, so it cannot easily replace Rust's own |
A true replacement will work for all types, using |
Do we actually want this? It'll probably lead to huge code bloat. |
This can accidentally leak sensitive information, too. Rather, we should ensure all stdlib asserts are helpful, like in #29984 |
What about only adding them in debug mode? |
Triage; no change. |
Closing in favor of out of tree solutions for now. A change to incorporate one of those into |
use ui_test regex capabilities We can have more precise patterns now, so use them for some of the tests where that makes sense. :)
It would be great if when asserts failed they printed something more useful than the offending line. Currently they print something like:
It'd be way nicer if they printed the values of variables that they use and the results of the functions they call:
The text was updated successfully, but these errors were encountered: