diff --git a/tests/dummy_book/mod.rs b/tests/dummy_book/mod.rs index fe3b547b..4ba9f12f 100644 --- a/tests/dummy_book/mod.rs +++ b/tests/dummy_book/mod.rs @@ -114,3 +114,13 @@ fn recursive_copy, B: AsRef>(from: A, to: B) -> Result<()> Ok(()) } + +pub fn new_copy_of_example_book() -> Result { + let temp = TempDir::new("book-example")?; + + let book_example = Path::new(env!("CARGO_MANIFEST_DIR")).join("book-example"); + + recursive_copy(book_example, temp.path())?; + + Ok(temp) +} \ No newline at end of file diff --git a/tests/rendered_output.rs b/tests/rendered_output.rs index 7e595620..18e1d88f 100644 --- a/tests/rendered_output.rs +++ b/tests/rendered_output.rs @@ -4,6 +4,7 @@ extern crate pretty_assertions; extern crate select; extern crate tempdir; extern crate walkdir; +extern crate tempdir; mod dummy_book; @@ -297,3 +298,13 @@ fn able_to_include_rust_files_in_chapters() { ]; assert_contains_strings(second, playpen_strings); } + +#[test] +fn example_book_can_build() { + let example_book_dir = dummy_book::new_copy_of_example_book().unwrap(); + + let mut md = MDBook::load(example_book_dir.path()).unwrap(); + + let got = md.build(); + assert!(got.is_ok()); +} \ No newline at end of file