aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/inheritance.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan.ochtman@ing.com>2019-03-18 10:06:01 +0100
committerLibravatar Dirkjan Ochtman <dirkjan.ochtman@ing.com>2019-03-18 10:06:01 +0100
commitcdaf7ea35d98b6c2a4d11d57b60abf6c3ff5ccc2 (patch)
tree522122bd87f7c40f2bc7dcd4b50c6c522c7567c7 /testing/tests/inheritance.rs
parent88f49df0a6f6f585151711f1f45e8c450114f89e (diff)
downloadaskama-cdaf7ea35d98b6c2a4d11d57b60abf6c3ff5ccc2.tar.gz
askama-cdaf7ea35d98b6c2a4d11d57b60abf6c3ff5ccc2.tar.bz2
askama-cdaf7ea35d98b6c2a4d11d57b60abf6c3ff5ccc2.zip
Create heritage for extends-only templates (fixes #224)
Diffstat (limited to 'testing/tests/inheritance.rs')
-rw-r--r--testing/tests/inheritance.rs12
1 files changed, 12 insertions, 0 deletions
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)]