use html5ever::driver;
use html5ever::serialize;
use html5ever::tendril::TendrilSink;
use markup5ever_rcdom::{RcDom, SerializableHandle};
#[test]
fn from_utf8() {
let dom = driver::parse_document(RcDom::default(), Default::default())
.from_utf8()
.one("
Test".as_bytes());
let mut serialized = Vec::new();
let document: SerializableHandle = dom.document.clone().into();
serialize::serialize(&mut serialized, &document, Default::default()).unwrap();
assert_eq!(
String::from_utf8(serialized).unwrap().replace(' ', ""),
"Test"
);
}
#[test]
fn many_templates() {
let mut body = String::new();
for _ in 1..10000 {
body.push_str("");
}
let _ = driver::parse_document(RcDom::default(), Default::default())
.from_utf8()
.one(body.as_bytes());
}