Migrate process_the_dummy_book to BookTest

This commit is contained in:
Eric Huss 2025-04-21 19:19:30 -07:00
parent b4221680e4
commit fca149a52c
4 changed files with 14 additions and 10 deletions

View file

@ -56,13 +56,3 @@ fn ask_the_preprocessor_to_blow_up() {
)
);
}
#[test]
fn process_the_dummy_book() {
let dummy_book = DummyBook::new();
let temp = dummy_book.build().unwrap();
let mut md = MDBook::load(temp.path()).unwrap();
md.with_preprocessor(example());
md.build().unwrap();
}

View file

@ -40,3 +40,15 @@ fn runs_preprocessors() {
assert_eq!(inner.run_count, 1);
assert_eq!(inner.rendered_with, ["html"]);
}
// No-op preprocessor works.
#[test]
fn nop_preprocessor() {
BookTest::from_dir("preprocessor/nop_preprocessor").run("build", |cmd| {
cmd.expect_stdout(str![[""]]).expect_stderr(str![[r#"
[TIMESTAMP] [INFO] (mdbook::book): Book building has started
[TIMESTAMP] [INFO] (mdbook::book): Running the html backend
"#]]);
});
}

View file

@ -0,0 +1,2 @@
[preprocessor.nop-preprocessor]
command = "cargo run --quiet --example nop-preprocessor --"