aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/templates/filters_join.html1
-rw-r--r--testing/tests/filters.rs25
2 files changed, 26 insertions, 0 deletions
diff --git a/testing/templates/filters_join.html b/testing/templates/filters_join.html
new file mode 100644
index 0000000..61cc249
--- /dev/null
+++ b/testing/templates/filters_join.html
@@ -0,0 +1 @@
+{{ s|join(", ") }}
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");
+}