From f71b2f03230fe8a6f50c3a02dcfeaed920fbdca3 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 8 Mar 2017 19:55:47 +0100 Subject: Add test for type parameters and where clauses (see #9) --- testing/tests/simple.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index 45bc0ff..8115fe0 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -106,3 +106,17 @@ fn test_option() { let none = OptionTemplate { var: None }; assert_eq!(none.render(), "none"); } + + +#[derive(Template)] +#[template(path = "generics.html")] +struct GenericsTemplate where U: std::fmt::Display { + t: T, + u: U, +} + +#[test] +fn test_generics() { + let t = GenericsTemplate { t: "a", u: 42 }; + assert_eq!(t.render(), "a42"); +} -- cgit