From cdaf7ea35d98b6c2a4d11d57b60abf6c3ff5ccc2 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 18 Mar 2019 10:06:01 +0100 Subject: Create heritage for extends-only templates (fixes #224) --- testing/tests/inheritance.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'testing/tests') diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs index 35fee80..32028c4 100644 --- a/testing/tests/inheritance.rs +++ b/testing/tests/inheritance.rs @@ -29,6 +29,18 @@ fn test_simple_extends() { ); } +#[derive(Template)] +#[template(source = "{% extends \"base.html\" %}", ext = "html")] +struct EmptyChild<'a> { + title: &'a str, +} + +#[test] +fn test_empty_child() { + let t = EmptyChild { title: "baz" }; + assert_eq!(t.render().unwrap(), "baz\n\nFoo\nCopyright 2017"); +} + pub mod parent { use askama::Template; #[derive(Template)] -- cgit