Add test for parent default block implementations

This commit is contained in:
Bastien Orivel 2017-08-25 13:28:43 +02:00 committed by Dirkjan Ochtman
parent fc7be3c927
commit aeac47cee0
2 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
{{ title }}
{% block content %}{% endblock %}
{% block foo %}Foo{% endblock %}
Copyright 2017

View File

@ -18,11 +18,11 @@ struct ChildTemplate<'a> {
#[test]
fn test_use_base_directly() {
let t = BaseTemplate { title: "Foo" };
assert_eq!(t.render().unwrap(), "Foo\n\nCopyright 2017");
assert_eq!(t.render().unwrap(), "Foo\n\nFoo\nCopyright 2017");
}
#[test]
fn test_simple_extends() {
let t = ChildTemplate { _parent: BaseTemplate { title: "Bar" } };
assert_eq!(t.render().unwrap(), "Bar\n(Bar) Content goes here\nCopyright 2017");
assert_eq!(t.render().unwrap(), "Bar\n(Bar) Content goes here\nFoo\nCopyright 2017");
}