mirror of
https://github.com/rust-lang/mdBook.git
synced 2025-12-27 07:54:20 -05:00
Add test for unbalanced html in a header
This is unexpectedly panicking.
This commit is contained in:
@@ -283,3 +283,25 @@ Check that the HTML tags are properly balanced.
|
||||
})
|
||||
.check_main_file("book/chapter_1.html", str!["<div>x<span>foo</span></div>"]);
|
||||
}
|
||||
|
||||
// Test for bug with unbalanced HTML handling in the heading.
|
||||
#[test]
|
||||
fn heading_with_unbalanced_html() {
|
||||
BookTest::init(|_| {})
|
||||
.change_file("src/chapter_1.md", "### Option<T>")
|
||||
.run("build", |cmd| {
|
||||
cmd.expect_failure().expect_stderr(str![[r#"
|
||||
INFO Book building has started
|
||||
INFO Running the html backend
|
||||
|
||||
thread 'main' ([..]) panicked at crates/mdbook-html/src/html/tree.rs:[..]
|
||||
internal error: expected empty tag stack.
|
||||
|
||||
path: `chapter_1.md`
|
||||
element=Element { name: QualName { prefix: None, ns: Atom('http://www.w3.org/1999/xhtml' type=static), local: Atom('h3' type=inline) }, attrs: {}, self_closing: false, was_raw: false }
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
|
||||
"#]]);
|
||||
});
|
||||
// .check_main_file("book/chapter_1.html", str![[""]]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user