diff --git a/integration-tests/templates/include.out b/integration-tests/templates/include.out new file mode 100644 index 0000000..e2eb994 --- /dev/null +++ b/integration-tests/templates/include.out @@ -0,0 +1,7 @@ + + INCLUDED: foo + + + INCLUDED: bar + + diff --git a/integration-tests/templates/include.stpl b/integration-tests/templates/include.stpl new file mode 100644 index 0000000..e157c4d --- /dev/null +++ b/integration-tests/templates/include.stpl @@ -0,0 +1,3 @@ +<% for s in strs { %> + <% include!("included.stpl"); %> +<% } %> diff --git a/integration-tests/templates/included.stpl b/integration-tests/templates/included.stpl new file mode 100644 index 0000000..13a1af2 --- /dev/null +++ b/integration-tests/templates/included.stpl @@ -0,0 +1 @@ +INCLUDED: <%= s %> diff --git a/integration-tests/tests/basic.rs b/integration-tests/tests/basic.rs index 983eb3d..78ad9da 100644 --- a/integration-tests/tests/basic.rs +++ b/integration-tests/tests/basic.rs @@ -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"] }); +}