diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-06-23 18:18:50 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-06-23 18:18:50 +0200 |
commit | 19bcb0f50ed5f0933cbf0e72b58ccb1e16cd71b5 (patch) | |
tree | 1730645b812f84f1002f802022e8a0f4c53b13e1 /testing/tests/operators.rs | |
parent | a46966b4ad0f9223d7e5e12d675b337a048afd3e (diff) | |
download | askama-19bcb0f50ed5f0933cbf0e72b58ccb1e16cd71b5.tar.gz askama-19bcb0f50ed5f0933cbf0e72b58ccb1e16cd71b5.tar.bz2 askama-19bcb0f50ed5f0933cbf0e72b58ccb1e16cd71b5.zip |
Add test for range operators
Diffstat (limited to 'testing/tests/operators.rs')
-rw-r--r-- | testing/tests/operators.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/tests/operators.rs b/testing/tests/operators.rs index edeb32a..5e23dff 100644 --- a/testing/tests/operators.rs +++ b/testing/tests/operators.rs @@ -40,3 +40,17 @@ fn test_precedence() { let t = PrecedenceTemplate {}; assert_eq!(t.render().unwrap(), "6".repeat(7)); } + +#[derive(Template)] +#[template(path = "ranges.txt")] +struct RangesTemplate<'a> { + foo: Vec<&'a str>, +} + +#[test] +fn test_ranges() { + let t = RangesTemplate { + foo: vec!["a", "b", "c", "d"], + }; + assert_eq!(t.render().unwrap(), "abcd\nbcd\n\na\nab"); +} |