Add integration test for include!

This commit is contained in:
Kogia-sima 2020-06-06 23:21:38 +09:00
parent c618f19cb6
commit cd8e3d832a
4 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,7 @@
INCLUDED: foo
INCLUDED: bar

View File

@ -0,0 +1,3 @@
<% for s in strs { %>
<% include!("included.stpl"); %>
<% } %>

View File

@ -0,0 +1 @@
INCLUDED: <%= s %>

View File

@ -73,3 +73,14 @@ struct CustomDelimiter;
fn custom_delimiter() {
assert_render("custom_delimiter", CustomDelimiter);
}
#[derive(TemplateOnce)]
#[template(path = "include.stpl")]
struct Include<'a> {
strs: &'a [&'a str],
}
#[test]
fn test_include() {
assert_render("include", Include { strs: &["foo", "bar"] });
}