From 19bcb0f50ed5f0933cbf0e72b58ccb1e16cd71b5 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sat, 23 Jun 2018 18:18:50 +0200 Subject: Add test for range operators --- testing/tests/operators.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'testing/tests/operators.rs') 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"); +} -- cgit