Skip to content
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

Swap inconsistent assert_eq! argument order in testing chapter #3497

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

regexident
Copy link

@regexident regexident commented Jan 4, 2023

The chapter starts off by using assert_eq!(…); with assert_eq!(actual, expected); argument ordering, but then suddenly swaps the order to assert_eq!(expected, actual); with assert_eq!(4, add_two(2));

Further more it then states …

We could write the assertion in this test as assert_eq!(add_two(2), 4), which would result in the same failure message
that displays `` assertion failed: (left == right).

… which seems weird as in the chapter assert_eq!(4, add_two(2)) actually is the odd one out, not assert_eq!(add_two(2), 4).

By swapping the args the message of "which would result in the same failure message" remains true, but the text feels a bit more consistent and predictable.

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.

None yet

1 participant