aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-05-20 21:05:45 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-05-20 21:05:58 +0200
commit60950c97debc6c141e5252519d45f2da51572cb5 (patch)
treea6d412ad32b0749294dfb454a5ab8e1c1b1aeae8 /testing/tests
parent0fb0c610cbbddd42daa6d9cd71b2dae0328bd7a8 (diff)
downloadaskama-60950c97debc6c141e5252519d45f2da51572cb5.tar.gz
askama-60950c97debc6c141e5252519d45f2da51572cb5.tar.bz2
askama-60950c97debc6c141e5252519d45f2da51572cb5.zip
Add support for nested blocks (fixes #85)
Diffstat (limited to 'testing/tests')
-rw-r--r--testing/tests/inheritance.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs
index a36f634..80fa457 100644
--- a/testing/tests/inheritance.rs
+++ b/testing/tests/inheritance.rs
@@ -58,3 +58,21 @@ fn test_different_module() {
"a\n(a) Content goes here\nFoo\nCopyright 2017"
);
}
+
+
+
+#[derive(Template)]
+#[template(path = "nested-base.html", print = "code")]
+struct NestedBaseTemplate {}
+
+#[derive(Template)]
+#[template(path = "nested-child.html", print = "code")]
+struct NestedChildTemplate {
+ _parent: NestedBaseTemplate,
+}
+
+#[test]
+fn test_nested_blocks() {
+ let t = NestedChildTemplate { _parent: NestedBaseTemplate {} };
+ assert_eq!(t.render().unwrap(), "\ndurpy\n");
+}