diff --git a/second-edition/src/ch07-01-mod-and-the-filesystem.md b/second-edition/src/ch07-01-mod-and-the-filesystem.md index 18c3e6ef7..3dc778ac1 100644 --- a/second-edition/src/ch07-01-mod-and-the-filesystem.md +++ b/second-edition/src/ch07-01-mod-and-the-filesystem.md @@ -29,15 +29,16 @@ Notice that Cargo generated *src/lib.rs* instead of *src/main.rs*. Inside mod tests { #[test] fn it_works() { + assert_eq!(2 + 2, 4); } } ``` -Cargo creates an empty test to help us get our library started, rather than the -“Hello, world!” binary that we get when we use the `--bin` option. We’ll look -at the `#[]` and `mod tests` syntax in the “Using `super` to Access a Parent -Module” section later in this chapter, but for now, leave this code at the -bottom of *src/lib.rs*. +Cargo creates an example test to help us get our library started, rather than +the “Hello, world!” binary that we get when we use the `--bin` option. We’ll +look at the `#[]` and `mod tests` syntax in the “Using `super` to Access a +Parent Module” section later in this chapter, but for now, leave this code at +the bottom of *src/lib.rs*. Because we don’t have a *src/main.rs* file, there’s nothing for Cargo to execute with the `cargo run` command. Therefore, we’ll use the `cargo build` diff --git a/second-edition/src/ch07-03-importing-names-with-use.md b/second-edition/src/ch07-03-importing-names-with-use.md index ad76a7057..07135c6a7 100644 --- a/second-edition/src/ch07-03-importing-names-with-use.md +++ b/second-edition/src/ch07-03-importing-names-with-use.md @@ -146,6 +146,7 @@ pub mod network; mod tests { #[test] fn it_works() { + assert_eq!(2 + 2, 4); } } ``` diff --git a/second-edition/src/ch11-01-writing-tests.md b/second-edition/src/ch11-01-writing-tests.md index 747bb8bd2..07e2a9718 100644 --- a/second-edition/src/ch11-01-writing-tests.md +++ b/second-edition/src/ch11-01-writing-tests.md @@ -120,6 +120,7 @@ Give the `it_works` function a different name, such as `exploration`, like so: mod tests { #[test] fn exploration() { + assert_eq!(2 + 2, 4); } } ``` @@ -148,6 +149,7 @@ like Listing 11-3: mod tests { #[test] fn exploration() { + assert_eq!(2 + 2, 4); } #[test] diff --git a/second-edition/src/ch11-02-running-tests.md b/second-edition/src/ch11-02-running-tests.md index 23c1cde22..452c7fc66 100644 --- a/second-edition/src/ch11-02-running-tests.md +++ b/second-edition/src/ch11-02-running-tests.md @@ -253,7 +253,7 @@ time consuming tests with the `ignore` attribute to exclude them: ```rust #[test] fn it_works() { - assert!(true); + assert_eq!(2 + 2, 4); } #[test]