From 7e8819f4d280749c14c7affe8d0dbf5f5b065dad Mon Sep 17 00:00:00 2001 From: Michael Bryan Date: Sun, 9 Jul 2017 22:08:57 +0800 Subject: [PATCH] Bye bye println() debugging --- tests/integration_tests.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index a92466eb..26558be5 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -233,21 +233,15 @@ fn create_book(passing_test: bool) -> TempDir { /// Read the contents of the provided file into memory and then iterate through /// the list of strings asserting that the file contains all of them. fn assert_contains_strings>(filename: P, strings: &[&str]) { - println!("Checking {}", filename.as_ref().display()); - println!(); + let filename = filename.as_ref(); let mut content = String::new(); - File::open(filename) + File::open(&filename) .expect("Couldn't open the provided file") .read_to_string(&mut content) - .unwrap(); - - println!("{}", content); - println!(); - println!(); + .expect("Couldn't read the file's contents"); for s in strings { - println!("Checking for {:?}", s); - assert!(content.contains(s)); + assert!(content.contains(s), "Searching for {:?} in {}\n\n{}", s, filename.display(), content); } }