Skip to content

Switch expected and actual in assert_eq! #6847

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

Closed

Conversation

steveklabnik
Copy link
Member

The original XUnit was expected, actual, but we had actual, expected.
http://junit.sourceforge.net/javadoc/org/junit/Assert.html#assertEquals%28double,%20double%29

With the new formatting, this doesn't matter as much, but it's nice to be
consistent with previous frameworks, and if we change the output such
that it does matter, better to be ready.

The original XUnit was expected, actual, but we had actual, expected.
http://junit.sourceforge.net/javadoc/org/junit/Assert.html#assertEquals%28double,%20double%29

With the new formatting, this doesn't matter as much, but it's nice to be
consistent with previous frameworks, and if we change the output such
that it does matter, better to be ready.
@steveklabnik
Copy link
Member Author

I'm not entirely sure how to fix this test :/

@brson
Copy link
Contributor

brson commented Jun 2, 2013

I guess that switching the order of the comparisons in the macros might fix it, so !((given_val == expected_val) && (expected_val == given_val)) becomes !((expected_val == given_val) && (given_val == expected_val)) etc. If so, then it's still probably just a bandaid to I imagine this would still show up if, e.g. the test cases to swapped their argument orders.

@steveklabnik
Copy link
Member Author

Hm. So maybe this just isn't a good patch? Some frameworks do do it this way, most just do it the other. Maybe best to just leave it alone?

@brson
Copy link
Contributor

brson commented Jun 10, 2013

I do prefer the (expected, actual) order.

@graydon graydon closed this Jun 13, 2013
@steveklabnik steveklabnik deleted the switch_expected_given branch October 25, 2017 18:25
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 25, 2021
Fix `manual_map` suggestion for `if let.. else ... if let.. else` chain

fixes: rust-lang#6847

changelog: Fix `manual_map` suggestion for `if let.. else ... if let.. else` chain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants