diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/templates/deep-nested-macro.html | 2 | ||||
-rw-r--r-- | testing/templates/nested-macro.html | 7 | ||||
-rw-r--r-- | testing/tests/macro.rs | 10 |
3 files changed, 19 insertions, 0 deletions
diff --git a/testing/templates/deep-nested-macro.html b/testing/templates/deep-nested-macro.html new file mode 100644 index 0000000..39e8e91 --- /dev/null +++ b/testing/templates/deep-nested-macro.html @@ -0,0 +1,2 @@ +{%- import "nested-macro.html" as libk -%} +{%- call libk::parent() -%} diff --git a/testing/templates/nested-macro.html b/testing/templates/nested-macro.html new file mode 100644 index 0000000..4a40cd9 --- /dev/null +++ b/testing/templates/nested-macro.html @@ -0,0 +1,7 @@ +{%- macro child() -%} + foo +{%- endmacro -%} + +{%- macro parent() -%} + {% call child() %} +{%- endmacro -%} diff --git a/testing/tests/macro.rs b/testing/tests/macro.rs index fb54f88..4e43d7c 100644 --- a/testing/tests/macro.rs +++ b/testing/tests/macro.rs @@ -26,3 +26,13 @@ fn test_import() { let t = ImportTemplate { s: "foo" }; assert_eq!(t.render().unwrap(), "foo foo foo"); } + +#[derive(Template)] +#[template(path = "deep-nested-macro.html")] +struct NestedTemplate; + +#[test] +fn test_nested() { + let t = NestedTemplate; + assert_eq!(t.render().unwrap(), "foo"); +} |