mirror of
https://github.com/rust-lang/mdBook.git
synced 2025-12-27 10:16:09 -05:00
add test: invalid table at the top level config
This commit is contained in:
@@ -128,6 +128,31 @@ fn bad_config_top_level() {
|
||||
unknown field `foo`, expected one of `book`, `build`, `rust`, `output`, `preprocessor`
|
||||
|
||||
|
||||
"#]]);
|
||||
});
|
||||
}
|
||||
|
||||
// An invalid table at the top level.
|
||||
#[test]
|
||||
fn bad_config_top_level_table() {
|
||||
BookTest::init(|_| {})
|
||||
.change_file(
|
||||
"book.toml",
|
||||
"[other]\n\
|
||||
foo = 123",
|
||||
)
|
||||
.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 1, column 2
|
||||
|
|
||||
1 | [other]
|
||||
| ^^^^^
|
||||
unknown field `other`, expected one of `book`, `build`, `rust`, `output`, `preprocessor`
|
||||
|
||||
|
||||
"#]]);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user