Migrate missing_optional_backends_are_not_fatal to BookTest

This commit is contained in:
Eric Huss 2025-04-21 19:35:35 -07:00
parent 86638abea9
commit f482aeaca3
4 changed files with 18 additions and 6 deletions

View file

@ -6,12 +6,6 @@ use std::fs;
use std::path::Path;
use tempfile::{Builder as TempFileBuilder, TempDir};
#[test]
fn missing_optional_backends_are_not_fatal() {
let (md, _temp) = dummy_book_with_backend("missing", "trduyvbhijnorgevfuhn", true);
assert!(md.build().is_ok());
}
#[test]
fn alternate_backend_with_arguments() {
let (md, _temp) = dummy_book_with_backend("arguments", "echo Hello World!", false);

View file

@ -91,3 +91,17 @@ fn missing_renderer() {
"#]]);
});
}
// Optional missing is not an error.
#[test]
fn missing_optional_not_fatal() {
BookTest::from_dir("renderer/missing_optional_not_fatal").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 missing backend
[TIMESTAMP] [INFO] (mdbook::renderer): Invoking the "missing" renderer
[TIMESTAMP] [WARN] (mdbook::renderer): The command `trduyvbhijnorgevfuhn` for backend `missing` was not found, but was marked as optional.
"#]]);
});
}

View file

@ -0,0 +1,4 @@
[output.missing]
command = "trduyvbhijnorgevfuhn"
optional = true