Add test for basic chained attributes

This commit is contained in:
Dirkjan Ochtman 2017-05-26 11:45:18 +02:00
parent 71d99927a6
commit ce84543b69
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1 @@
{{ inner.holder.a }}

View File

@ -93,6 +93,25 @@ fn test_attr() {
}
struct NestedHolder {
holder: Holder,
}
#[derive(Template)]
#[template(path = "nested-attr.html")]
struct NestedAttrTemplate {
inner: NestedHolder,
}
#[test]
fn test_nested_attr() {
let t = NestedAttrTemplate {
inner: NestedHolder { holder: Holder { a: 5 } }
};
assert_eq!(t.render(), "5");
}
#[derive(Template)]
#[template(path = "option.html")]
struct OptionTemplate<'a> {