diff options
Diffstat (limited to 'testing/tests')
-rw-r--r-- | testing/tests/filters.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs index 524014e..b24ff61 100644 --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -49,3 +49,28 @@ fn test_my_filter() { let t = MyFilterTemplate { s: "foo" }; assert_eq!(t.render().unwrap(), "faa"); } + + +#[derive(Template)] +#[template(path= "filters_join.html")] +struct JoinTemplate<'a> { + s: &'a [&'a str], +} + +#[test] +fn test_join() { + let t = JoinTemplate { s: &["foo", "bar", "bazz"] }; + assert_eq!(t.render().unwrap(), "foo, bar, bazz"); +} + +#[derive(Template)] +#[template(path= "filters_join.html")] +struct VecJoinTemplate { + s: Vec<String> +} + +#[test] +fn test_vec_join() { + let t = VecJoinTemplate { s: vec!["foo".into(), "bar".into(), "bazz".into()] }; + assert_eq!(t.render().unwrap(), "foo, bar, bazz"); +} |