mirror of
https://github.com/rust-lang/mdBook.git
synced 2025-12-27 10:16:09 -05:00
Merge pull request #2815 from szabgab/test/invalid-field-in-rust-table
add test: invalid field in the top level rust table in config
This commit is contained in:
@@ -179,6 +179,31 @@ fn bad_config_in_book_table() {
|
||||
unknown field `foo`, expected one of `title`, `authors`, `description`, `src`, `language`, `text-direction`
|
||||
|
||||
|
||||
"#]]);
|
||||
});
|
||||
}
|
||||
|
||||
// An invalid key in the main rust table.
|
||||
#[test]
|
||||
fn bad_config_in_rust_table() {
|
||||
BookTest::init(|_| {})
|
||||
.change_file(
|
||||
"book.toml",
|
||||
"[rust]\n\
|
||||
title = \"bad-config\"\n",
|
||||
)
|
||||
.run("build", |cmd| {
|
||||
cmd.expect_failure()
|
||||
.expect_stdout(str![[""]])
|
||||
.expect_stderr(str![[r#"
|
||||
[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Invalid configuration file
|
||||
[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: TOML parse error at line 2, column 1
|
||||
|
|
||||
2 | title = "bad-config"
|
||||
| ^^^^^
|
||||
unknown field `title`, expected `edition`
|
||||
|
||||
|
||||
"#]]);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user