From a7ca2e169fed3ff3c53fc86f1a72588e8a6b5644 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Sun, 9 Mar 2025 14:40:00 +0200 Subject: [PATCH 1/2] [test] error Couldn't open SUMMARY.md in load_book --- src/book/book.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/book/book.rs b/src/book/book.rs index c7150972..8c9d81d6 100644 --- a/src/book/book.rs +++ b/src/book/book.rs @@ -647,4 +647,19 @@ And here is some \ let got = load_book_from_disk(&summary, temp.path()); assert!(got.is_err()); } + + #[test] + fn cant_open_summary_md() { + let cfg = BuildConfig::default(); + let temp_dir = TempFileBuilder::new().prefix("book").tempdir().unwrap(); + + let got = load_book(&temp_dir, &cfg); + assert!(got.is_err()); + let error_message = got.err().unwrap().to_string(); + let expeceted = format!( + r#"Couldn't open SUMMARY.md in "{}" directory"#, + temp_dir.path().display() + ); + assert_eq!(error_message, expeceted); + } } From 5fa9f12427274e316ca57a64795ec3abac0d95f7 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Sun, 9 Mar 2025 19:13:53 +0200 Subject: [PATCH 2/2] try to fix expected error on windows --- src/book/book.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/book/book.rs b/src/book/book.rs index 8c9d81d6..454f242e 100644 --- a/src/book/book.rs +++ b/src/book/book.rs @@ -657,8 +657,8 @@ And here is some \ assert!(got.is_err()); let error_message = got.err().unwrap().to_string(); let expeceted = format!( - r#"Couldn't open SUMMARY.md in "{}" directory"#, - temp_dir.path().display() + r#"Couldn't open SUMMARY.md in {:?} directory"#, + temp_dir.path() ); assert_eq!(error_message, expeceted); }