Add test for imports

This commit is contained in:
KitsuneCafe 2024-02-19 05:21:51 -05:00
parent 54cfd04c53
commit f382dcb03b

View file

@ -88,6 +88,25 @@ mod tests {
); );
} }
#[test]
fn import_parse() {
let mut parser = MarkdownTeraRewriter::new();
let mut buf = Vec::new();
parser
.parse(
"test.html",
b"<p>{% extends \"base.html\" %}\n{% import \"macros.html\" %}\n{% block content %}</p>\n<div><p>hi :3</p></div>{% endblock content %}",
&mut buf,
)
.unwrap();
assert_eq!(
"{% extends \"base.html\" %}\n{% import \"macros.html\" %}\n{% block content %}\n<div><p>hi :3</p></div>{% endblock content %}",
String::from_utf8_lossy(&buf)
);
}
#[test] #[test]
fn preformatter() { fn preformatter() {
let mut parser = MarkdownTeraPreformatter::new(); let mut parser = MarkdownTeraPreformatter::new();