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:
commit
a40f1f281b
1 changed files with 25 additions and 0 deletions
|
|
@ -179,6 +179,31 @@ fn bad_config_in_book_table() {
|
||||||
unknown field `foo`, expected one of `title`, `authors`, `description`, `src`, `language`, `text-direction`
|
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`
|
||||||
|
|
||||||
|
|
||||||
"#]]);
|
"#]]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue