3 ms·
The downside to enforcing an order is the compiler cannot enforce an order so people absolutely will get it wrong and not notice until much later when the test
by eridius 8y ago
The downside to enforcing an order is the compiler cannot enforce an order so people absolutely will get it wrong and not notice until much later when the test breaks and they get really confused because the message is telling them the expected value is the actual value and vice versa.
- tomjakubowski 8y agoWe could have a macro like: test_eq!(expected=(<expr>), actual=(<expr>)); Where those "assignments" could be specified in either order. Playground example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a4142e215dfb46ebfdab447ec22b6b95 https://play.rust-lang.org/?version=stable&mode=debug&editio...
- xixixao 8y agoI really like this, not that I would want to write this every time, but because you could have a macro rule that doesn't specify expected/actual, for those rare cases where both sides are computed ("actual").