aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/templates/for.html3
-rw-r--r--testing/tests/simple.rs15
2 files changed, 18 insertions, 0 deletions
diff --git a/testing/templates/for.html b/testing/templates/for.html
new file mode 100644
index 0000000..c38e6bb
--- /dev/null
+++ b/testing/templates/for.html
@@ -0,0 +1,3 @@
+{% for s in strings %}
+ {{ s }}
+{% endfor %}
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index b8274c3..ab5e209 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -64,3 +64,18 @@ fn test_else_if() {
let s = ElseIfTemplate { cond: false, check: true };
assert_eq!(s.render(), "checked\n");
}
+
+
+#[derive(Template)]
+#[template(path = "for.html")]
+struct ForTemplate {
+ strings: Vec<String>,
+}
+
+#[test]
+fn test_for() {
+ let s = ForTemplate {
+ strings: vec!["A".to_string(), "alfa".to_string(), "1".to_string()],
+ };
+ assert_eq!(s.render(), "\n A\n\n alfa\n\n 1\n\n");
+}