From c81c85a61e57989dc02b173cb2ed5de03c726c1e Mon Sep 17 00:00:00 2001 From: Brad Clawsie Date: Sun, 22 Nov 2026 13:19:59 -0600 Subject: fix: learn_17 corrections --- learn_17/src/main.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'learn_17/src/main.rs') diff --git a/learn_17/src/main.rs b/learn_17/src/main.rs index 559a0c6..d6db6d6 100644 --- a/learn_17/src/main.rs +++ b/learn_17/src/main.rs @@ -78,7 +78,21 @@ mod tests { let d0 = Document::new("t".to_string(), "a b c".to_string()); let d1 = Document::new("t".to_string(), "a".to_string()); assert!(contains_text(&d0, d1)); - assert!(!contains_text(&d0, "z".to_string())); + assert!(!contains_text(&d0, "z".to_string())); + } + + #[test] + fn test_document_reuse() { + let doc = Document::new( + "Notes".to_string(), + "Rust ownership matters".to_string(), + ); + + assert_eq!(word_count(&doc), 3); + assert!(contains_text(&doc, "ownership")); + assert!(contains_text(&doc, "Rust")); + assert_eq!(doc.title(), "Notes"); + assert_eq!(doc.body(), "Rust ownership matters"); } } -- cgit v1.2.3