From 4417f8cb0a1ff65a27a495987ff8f770b350dbcf Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 5 Nov 2025 10:45:46 -0800 Subject: [PATCH] Add a test for unclosed HTML tags --- tests/testsuite/rendering.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/testsuite/rendering.rs b/tests/testsuite/rendering.rs index 7f2fffa9..961710ed 100644 --- a/tests/testsuite/rendering.rs +++ b/tests/testsuite/rendering.rs @@ -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", "
xfooxyz") + .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!["
xfooxyz
"], + ); +}