From c981c7174a2482bd0986599eff8a7f7bd46907ed Mon Sep 17 00:00:00 2001 From: Jahwi Date: Thu, 13 Aug 2020 22:38:06 +0100 Subject: [PATCH] Correct listing 11-10: Take test module out of main function. --- .../ch11-writing-automated-tests/listing-11-10/src/lib.rs | 4 ++++ src/ch11-02-running-tests.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs b/listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs index 6fd76ce006..62d0fddbf1 100644 --- a/listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs +++ b/listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs @@ -1,3 +1,6 @@ +fn main() {} + +// ANCHOR: here fn prints_and_returns_10(a: i32) -> i32 { println!("I got the value {}", a); 10 @@ -19,3 +22,4 @@ mod tests { assert_eq!(5, value); } } +// ANCHOR_END: here diff --git a/src/ch11-02-running-tests.md b/src/ch11-02-running-tests.md index da31ca804c..7941ce786c 100644 --- a/src/ch11-02-running-tests.md +++ b/src/ch11-02-running-tests.md @@ -62,7 +62,7 @@ parameter and returns 10, as well as a test that passes and a test that fails. Filename: src/lib.rs ```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}} ``` Listing 11-10: Tests for a function that calls