-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Decide whether we want to standardize which assert_eq!
parameter ("left" or "right") should be used for "expected" value
#11270
Comments
I think consistency is a good thing. I personally prefer According to the internet there appears to be no consensus across rust https://users.rust-lang.org/t/assert-eq-expected-and-actual/20304 (perhaps the If we want to standardize (which seems like a good thing to me) it seems like we would:
|
(Thank you for raising this @findepi ) |
FYI, somewhat related I do think RustRover has a bug around diffing results where it flips the expected and actual in the diff. See https://youtrack.jetbrains.com/issue/IJPL-157945. I need to provide a minimal test case for that |
I agree @Omega359 this looks more like RustRover issue. It seems that RR has some limitations under which they are working (intellij-rust/intellij-rust#3848). I came across an assertions library for Rust: https://github.com/google/assertor.
Does anyone have experiences with it in a larger code base? |
That seems similar to the assertJ Java assertion library which I've used in the past. Fluent api's like that can be more verbose but in general I find them a lot easier to use. |
assert_eq!
names its parameters "left" and "right" and doesn't seem to designate which one is expected and which is actual.However, when a test is run from RustRover, the IDE is apparently opinionated and currently expects the "right" to be "the expected" (see screenshot below).
Let's decide whether we as the project want to care about this. Currently, the code varies: example 1, example 2.
Some RustRover references
The text was updated successfully, but these errors were encountered: