2017-07-10 18:17:19 +08:00
|
|
|
extern crate mdbook;
|
2017-09-02 07:40:39 +08:00
|
|
|
extern crate tempdir;
|
2017-07-10 18:17:19 +08:00
|
|
|
|
2017-09-02 07:40:39 +08:00
|
|
|
mod dummy;
|
|
|
|
|
|
|
|
use dummy::DummyBook;
|
2017-07-10 18:17:19 +08:00
|
|
|
use mdbook::MDBook;
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn mdbook_can_correctly_test_a_passing_book() {
|
2017-10-03 19:40:23 +08:00
|
|
|
let temp = DummyBook::default().with_passing_test(true).build();
|
2017-07-10 18:17:19 +08:00
|
|
|
let mut md = MDBook::new(temp.path());
|
|
|
|
|
|
|
|
assert!(md.test(vec![]).is_ok());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn mdbook_detects_book_with_failing_tests() {
|
2017-10-03 19:40:23 +08:00
|
|
|
let temp = DummyBook::default().with_passing_test(false).build();
|
2017-07-10 18:17:19 +08:00
|
|
|
let mut md: MDBook = MDBook::new(temp.path());
|
|
|
|
|
|
|
|
assert!(md.test(vec![]).is_err());
|
2017-09-02 07:40:39 +08:00
|
|
|
}
|