2017-07-10 18:17:19 +08:00
|
|
|
extern crate tempdir;
|
|
|
|
extern crate mdbook;
|
|
|
|
|
|
|
|
mod helpers;
|
|
|
|
use mdbook::MDBook;
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn mdbook_can_correctly_test_a_passing_book() {
|
2017-08-02 22:29:28 +08:00
|
|
|
let temp = helpers::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-08-02 22:29:28 +08:00
|
|
|
let temp = helpers::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());
|
|
|
|
}
|