2017-11-16 15:51:12 +08:00
|
|
|
mod dummy_book;
|
2017-09-02 07:40:39 +08:00
|
|
|
|
2019-05-26 02:50:41 +08:00
|
|
|
use crate::dummy_book::DummyBook;
|
2018-01-17 06:13:47 +08:00
|
|
|
|
2018-07-24 01:45:01 +08:00
|
|
|
use mdbook::MDBook;
|
2017-07-10 18:17:19 +08:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn mdbook_can_correctly_test_a_passing_book() {
|
2017-11-16 15:51:12 +08:00
|
|
|
let temp = DummyBook::new().with_passing_test(true).build().unwrap();
|
2021-06-26 03:51:43 +08:00
|
|
|
let mut md = MDBook::load(temp.path(), false).unwrap();
|
2017-07-10 18:17:19 +08:00
|
|
|
|
2019-08-07 10:11:36 +08:00
|
|
|
let result = md.test(vec![]);
|
|
|
|
assert!(
|
|
|
|
result.is_ok(),
|
|
|
|
"Tests failed with {}",
|
|
|
|
result.err().unwrap()
|
|
|
|
);
|
2017-07-10 18:17:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn mdbook_detects_book_with_failing_tests() {
|
2017-11-16 15:51:12 +08:00
|
|
|
let temp = DummyBook::new().with_passing_test(false).build().unwrap();
|
2021-06-26 03:51:43 +08:00
|
|
|
let mut md = MDBook::load(temp.path(), false).unwrap();
|
2017-07-10 18:17:19 +08:00
|
|
|
|
|
|
|
assert!(md.test(vec![]).is_err());
|
2017-09-02 07:40:39 +08:00
|
|
|
}
|