From 60950c97debc6c141e5252519d45f2da51572cb5 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 20 May 2018 21:05:45 +0200 Subject: Add support for nested blocks (fixes #85) --- testing/tests/inheritance.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'testing/tests/inheritance.rs') 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"); +} -- cgit