Merge pull request #3284 from bravequickcleverfibreyarn/ch11-03-test-organization.md

ch11-03: Unnecessary import removal
This commit is contained in:
Chris Krycho 2024-04-18 12:13:52 -06:00 committed by GitHub
commit 18effd3176
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
use adder;
use adder::add_two;
#[test]
fn it_adds_two() {
assert_eq!(4, adder::add_two(2));
assert_eq!(4, add_two(2));
}

View File

@ -118,8 +118,9 @@ Enter the code in Listing 11-13 into the *tests/integration_test.rs* file:
`adder` crate</span>
Each file in the `tests` directory is a separate crate, so we need to bring our
library into each test crates scope. For that reason we add `use adder` at the
top of the code, which we didnt need in the unit tests.
library into each test crates scope. For that reason we add `use
adder::add_two` at the top of the code, which we didnt need in the unit
tests.
We dont need to annotate any code in *tests/integration_test.rs* with
`#[cfg(test)]`. Cargo treats the `tests` directory specially and compiles files