summaryrefslogtreecommitdiffstats
path: root/vendor/mdbook/tests/testing.rs
blob: 2b2c0fd0d7058068f351731a5da3b95251b94cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
mod dummy_book;

use crate::dummy_book::DummyBook;

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![]);
    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![]).is_err());
}