Migrate missing_backends_are_fatal to BookTest
This commit is contained in:
parent
a2cf838baf
commit
86638abea9
4 changed files with 22 additions and 9 deletions
|
|
@ -6,15 +6,6 @@ use std::fs;
|
|||
use std::path::Path;
|
||||
use tempfile::{Builder as TempFileBuilder, TempDir};
|
||||
|
||||
#[test]
|
||||
fn missing_backends_are_fatal() {
|
||||
let (md, _temp) = dummy_book_with_backend("missing", "trduyvbhijnorgevfuhn", false);
|
||||
let got = md.build();
|
||||
assert!(got.is_err());
|
||||
let error_message = got.err().unwrap().to_string();
|
||||
assert_eq!(error_message, "Rendering failed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_optional_backends_are_not_fatal() {
|
||||
let (md, _temp) = dummy_book_with_backend("missing", "trduyvbhijnorgevfuhn", true);
|
||||
|
|
|
|||
|
|
@ -72,3 +72,22 @@ fn failing_command() {
|
|||
"#]]);
|
||||
});
|
||||
}
|
||||
|
||||
// Renderer command is missing.
|
||||
#[test]
|
||||
fn missing_renderer() {
|
||||
BookTest::from_dir("renderer/missing_renderer").run("build", |cmd| {
|
||||
cmd.expect_failure()
|
||||
.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] [ERROR] (mdbook::renderer): The command `trduyvbhijnorgevfuhn` wasn't found, is the "missing" backend installed? If you want to ignore this error when the "missing" backend is not installed, set `optional = true` in the `[output.missing]` section of the book.toml configuration file.
|
||||
[TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed
|
||||
[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: Unable to start the backend
|
||||
[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: [NOT_FOUND]
|
||||
|
||||
"#]]);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
3
tests/testsuite/renderer/missing_renderer/book.toml
Normal file
3
tests/testsuite/renderer/missing_renderer/book.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[output.missing]
|
||||
command = "trduyvbhijnorgevfuhn"
|
||||
|
||||
0
tests/testsuite/renderer/missing_renderer/src/SUMMARY.md
Normal file
0
tests/testsuite/renderer/missing_renderer/src/SUMMARY.md
Normal file
Loading…
Add table
Reference in a new issue