From 504a5f41b3e33a45ed14598d2603277ad5b1a355 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sat, 4 Feb 2017 10:59:35 +0100 Subject: Add basic support for loops --- testing/tests/simple.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'testing/tests/simple.rs') 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, +} + +#[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"); +} -- cgit