aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-12 20:38:14 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-12 20:38:14 +0100
commitc74e9e8971c06ed77eeee79cbac2c4c325b3ffa4 (patch)
tree3bf410232558d989379681f4593a717118e6bebd /testing/tests
parent7b831bd79fd1a1b3f6149420b34df1a19644554c (diff)
downloadaskama-c74e9e8971c06ed77eeee79cbac2c4c325b3ffa4.tar.gz
askama-c74e9e8971c06ed77eeee79cbac2c4c325b3ffa4.tar.bz2
askama-c74e9e8971c06ed77eeee79cbac2c4c325b3ffa4.zip
Explicitly pass trait implementation to top-level base template method
This requires a base template struct to be a member of the derived template's context, but allows the base template to access base template fields.
Diffstat (limited to '')
-rw-r--r--testing/tests/inheritance.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs
index 5d5c23c..156358e 100644
--- a/testing/tests/inheritance.rs
+++ b/testing/tests/inheritance.rs
@@ -10,7 +10,9 @@ struct BaseTemplate { }
#[derive(Template)]
#[template(path = "child.html")]
-struct ChildTemplate { }
+struct ChildTemplate {
+ _parent: BaseTemplate,
+}
#[test]
fn test_use_base_directly() {
@@ -20,6 +22,6 @@ fn test_use_base_directly() {
#[test]
fn test_simple_extends() {
- let t = ChildTemplate { };
+ let t = ChildTemplate { _parent: BaseTemplate {} };
assert_eq!(t.render(), "Content goes here\nCopyright 2017\n");
}