mdBook/tests/testing.rs

27 lines
654 B
Rust
Raw Normal View History

mod dummy_book;
use crate::dummy_book::DummyBook;
2018-07-24 01:45:01 +08:00
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::load(temp.path()).unwrap();
let result = md.test(vec![], vec![], false);
assert!(
result.is_ok(),
"Tests failed with {}",
result.err().unwrap()
);
}
#[test]
fn mdbook_detects_book_with_failing_tests() {
let temp = DummyBook::new().with_passing_test(false).build().unwrap();
let mut md = MDBook::load(temp.path()).unwrap();
assert!(md.test(vec![], vec![], false).is_err());
}