Skip to content

Commit f6c11d1

Browse files
committed
add test: invalid table at the top level config
1 parent 313be71 commit f6c11d1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/testsuite/config.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,31 @@ fn bad_config_top_level() {
128128
unknown field `foo`, expected one of `book`, `build`, `rust`, `output`, `preprocessor`
129129
130130
131+
"#]]);
132+
});
133+
}
134+
135+
// An invalid table at the top level.
136+
#[test]
137+
fn bad_config_top_level_table() {
138+
BookTest::init(|_| {})
139+
.change_file(
140+
"book.toml",
141+
"[other]\n\
142+
foo = 123",
143+
)
144+
.run("build", |cmd| {
145+
cmd.expect_failure()
146+
.expect_stdout(str![[""]])
147+
.expect_stderr(str![[r#"
148+
[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Invalid configuration file
149+
[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: TOML parse error at line 1, column 2
150+
|
151+
1 | [other]
152+
| ^^^^^
153+
unknown field `other`, expected one of `book`, `build`, `rust`, `output`, `preprocessor`
154+
155+
131156
"#]]);
132157
});
133158
}

0 commit comments

Comments
 (0)