File: build.rs

package info (click to toggle)
mdbook 0.4.48%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,080 kB
  • sloc: javascript: 1,066; sh: 75; python: 28; makefile: 24
file content (28 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (13)
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
27
28
use crate::cli::cmd::mdbook_cmd;
use crate::dummy_book::DummyBook;

#[test]
fn mdbook_cli_dummy_book_generates_index_html() {
    let temp = DummyBook::new().build().unwrap();

    // doesn't exist before
    assert!(!temp.path().join("book").exists());

    let mut cmd = mdbook_cmd();
    cmd.arg("build").current_dir(temp.path());
    cmd.assert()
        .success()
        .stderr(
            predicates::str::is_match(r##"Stack depth exceeded in first[\\/]recursive.md."##)
                .unwrap(),
        )
        .stderr(predicates::str::contains(
            r##"[INFO] (mdbook::book): Running the html backend"##,
        ));

    // exists afterward
    assert!(temp.path().join("book").exists());

    let index_file = temp.path().join("book/index.html");
    assert!(index_file.exists());
}