diff --git a/listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/output.txt b/listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/output.txt index 5e91c58b4d..01b58572bd 100644 --- a/listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/output.txt +++ b/listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/output.txt @@ -9,10 +9,9 @@ test tests::it_adds_two ... FAILED failures: ---- tests::it_adds_two stdout ---- -thread 'tests::it_adds_two' panicked at src/lib.rs:11:9: assertion `left == right` failed - left: 4 - right: 5 + left: 5 + right: 4 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/src/lib.rs b/listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/src/lib.rs index f186625261..d7b4e139b8 100644 --- a/listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/src/lib.rs +++ b/listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/src/lib.rs @@ -10,6 +10,6 @@ mod tests { #[test] fn it_adds_two() { - assert_eq!(4, add_two(2)); + assert_eq!(add_two(2), 4); } } diff --git a/src/ch11-01-writing-tests.md b/src/ch11-01-writing-tests.md index 14bcc95df9..03bf244c69 100644 --- a/src/ch11-01-writing-tests.md +++ b/src/ch11-01-writing-tests.md @@ -317,7 +317,7 @@ assertion functions are called `expected` and `actual`, and the order in which we specify the arguments matters. However, in Rust, they’re called `left` and `right`, and the order in which we specify the value we expect and the value the code produces doesn’t matter. We could write the assertion in this test as -`assert_eq!(add_two(2), 4)`, which would result in the same failure message +`assert_eq!(4, add_two(2))`, which would result in the same failure message that displays `` assertion failed: `(left == right)` ``. The `assert_ne!` macro will pass if the two values we give it are not equal and