From ce84543b69b69ab2030ce4daeae3f26d5008b11d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 26 May 2017 11:45:18 +0200 Subject: Add test for basic chained attributes --- testing/templates/nested-attr.html | 1 + testing/tests/simple.rs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 testing/templates/nested-attr.html (limited to 'testing') diff --git a/testing/templates/nested-attr.html b/testing/templates/nested-attr.html new file mode 100644 index 0000000..3bbbbc3 --- /dev/null +++ b/testing/templates/nested-attr.html @@ -0,0 +1 @@ +{{ inner.holder.a }} diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index a04b3fa..980321f 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -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> { -- cgit