diff options
Diffstat (limited to 'testing/tests/loops.rs')
-rw-r--r-- | testing/tests/loops.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs index ac19d43..6c2f35d 100644 --- a/testing/tests/loops.rs +++ b/testing/tests/loops.rs @@ -32,3 +32,17 @@ fn test_nested_for() { }; assert_eq!(s.render().unwrap(), "1\n 0a1b2c2\n 0one1two"); } + +#[derive(Template)] +#[template(path = "precedence-for.html")] +struct PrecedenceTemplate<'a> { + strings: Vec<&'a str>, +} + +#[test] +fn test_precedence_for() { + let s = PrecedenceTemplate { + strings: vec!["A", "alfa", "1"], + }; + assert_eq!(s.render().unwrap(), "0. A (first)\n1. alfa\n2. 1\n"); +} |