Merge pull request #2814 from szabgab/test/invalid-table-at-top-level
add test: invalid table at the top level config
This commit is contained in:
commit
6c847275c5
1 changed files with 25 additions and 0 deletions
|
|
@ -128,6 +128,31 @@ fn bad_config_top_level() {
|
||||||
unknown field `foo`, expected one of `book`, `build`, `rust`, `output`, `preprocessor`
|
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`
|
||||||
|
|
||||||
|
|
||||||
"#]]);
|
"#]]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue