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