Skip to content

Commit

Permalink
Merge pull request #2427 from jahwi/master
Browse files Browse the repository at this point in the history
Correct listing 11-10: Take tests module out of main function.
  • Loading branch information
steveklabnik authored Aug 14, 2020
2 parents 7d3c7b1 + c981c71 commit c0a6a61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
fn main() {}

// ANCHOR: here
fn prints_and_returns_10(a: i32) -> i32 {
println!("I got the value {}", a);
10
Expand All @@ -19,3 +22,4 @@ mod tests {
assert_eq!(5, value);
}
}
// ANCHOR_END: here
2 changes: 1 addition & 1 deletion src/ch11-02-running-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ parameter and returns 10, as well as a test that passes and a test that fails.
<span class="filename">Filename: src/lib.rs</span>

```rust,panics
{{#rustdoc_include ../listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs}}
{{#rustdoc_include ../listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs:here}}
```

<span class="caption">Listing 11-10: Tests for a function that calls
Expand Down

0 comments on commit c0a6a61

Please sign in to comment.