diff options
Diffstat (limited to '')
-rw-r--r-- | testing/tests/simple.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index 28a6a0a..ff63587 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -3,6 +3,8 @@ extern crate askama; use askama::Template; +use std::collections::HashMap; + #[derive(Template)] #[template(path = "simple.html")] struct VariablesTemplate<'a> { @@ -233,3 +235,17 @@ fn test_minus() { let t = MinusTemplate { foo: 1 }; assert_eq!(t.render().unwrap(), "Hello"); } + +#[derive(Template)] +#[template(source = "{{ foo[\"bar\"] }}", ext = "txt", print = "code")] +struct IndexTemplate { + foo: HashMap<String, String>, +} + +#[test] +fn test_index() { + let mut foo = HashMap::new(); + foo.insert("bar".into(), "baz".into()); + let t = IndexTemplate { foo }; + assert_eq!(t.render().unwrap(), "baz"); +} |