use bytes::BytesMut; use rstml_component::{write_html, HtmlFormatter}; macro_rules! assert_html_eq { ($expected:expr, $($rest:tt)*) => { let mut buffer = BytesMut::new(); let mut formatter = HtmlFormatter::new(&mut buffer); write_html!(formatter, $($rest)*).expect("failed to write html"); let raw = buffer.as_ref(); let as_str = std::str::from_utf8(raw).expect("invalid utf-8"); assert_eq!(as_str, $expected); }; } #[test] fn empty() { assert_html_eq!("",); } #[test] fn empty_div() { assert_html_eq!("
", ); assert_html_eq!("", ); } #[test] fn empty_div_with_attributes() { assert_html_eq!("", ); } #[test] fn dynamic_attributes() { let attributes = ("class", "test"); assert_html_eq!("", ); } #[test] fn doctype() { assert_html_eq!("", ); } #[test] fn fragment() { assert_html_eq!("", <>>); } #[test] fn children() { assert_html_eq!("