Add a test for unclosed HTML tags

This commit is contained in:
Eric Huss
2025-11-05 10:45:46 -08:00
parent cc7f8be496
commit 4417f8cb0a

View File

@@ -239,3 +239,25 @@ fn html_blocks() {
fn code_block_fenced_with_indent() {
BookTest::from_dir("rendering/code_blocks_fenced_with_indent").check_all_main_files();
}
// Unclosed HTML tags.
//
// Note that the HTML parsing algorithm is much more complicated than what
// this is checking.
#[test]
fn unclosed_html_tags() {
BookTest::init(|_| {})
.change_file("src/chapter_1.md", "<div>x<span>foo<i>xyz")
.run("build", |cmd| {
cmd.expect_stderr(str![[r#"
INFO Book building has started
INFO Running the html backend
INFO HTML book written to `[ROOT]/book`
"#]]);
})
.check_main_file(
"book/chapter_1.html",
str!["<div>x<span>foo<i>xyz</i></span></div>"],
);
}