From f382dcb03b011f409ff855b598b5ababc488729b Mon Sep 17 00:00:00 2001 From: KitsuneCafe <10284516+kitsunecafe@users.noreply.github.com> Date: Mon, 19 Feb 2024 05:21:51 -0500 Subject: [PATCH] Add test for imports --- src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 058ef2b..e50bc5b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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"

{% extends \"base.html\" %}\n{% import \"macros.html\" %}\n{% block content %}

\n

hi :3

{% endblock content %}", + &mut buf, + ) + .unwrap(); + + assert_eq!( + "{% extends \"base.html\" %}\n{% import \"macros.html\" %}\n{% block content %}\n

hi :3

{% endblock content %}", + String::from_utf8_lossy(&buf) + ); + } + #[test] fn preformatter() { let mut parser = MarkdownTeraPreformatter::new();