d56ff94ce6
* Created regression tests for the table of contents * Refactoring to make the test more readable * Fixed some bitrot and removed the (now redundant) tests/helper module * Removed the include_str!() stuff and use just the dummy book for testing * Regression tests now pass again! * Pinned a `*` dependency to use a particular version * Made sure test mocks return errors instead of panicking * Addressed the rest of @budziq's review * Replaced a file open/read with file_to_string
24 lines
525 B
Rust
24 lines
525 B
Rust
extern crate mdbook;
|
|
|
|
mod dummy_book;
|
|
|
|
use dummy_book::DummyBook;
|
|
use mdbook::MDBook;
|
|
|
|
|
|
#[test]
|
|
fn mdbook_can_correctly_test_a_passing_book() {
|
|
let temp = DummyBook::new().with_passing_test(true).build().unwrap();
|
|
let mut md = MDBook::new(temp.path());
|
|
|
|
assert!(md.test(vec![]).is_ok());
|
|
}
|
|
|
|
#[test]
|
|
fn mdbook_detects_book_with_failing_tests() {
|
|
let temp = DummyBook::new().with_passing_test(false).build().unwrap();
|
|
let mut md: MDBook = MDBook::new(temp.path());
|
|
|
|
assert!(md.test(vec![]).is_err());
|
|
}
|