aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/simple.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-03-08 19:55:47 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-03-08 19:55:47 +0100
commitf71b2f03230fe8a6f50c3a02dcfeaed920fbdca3 (patch)
tree84263883f05fdcc739bc7c35b904c90d4849c303 /testing/tests/simple.rs
parentc927d51fe10a2050e0afd143e300615facd781b7 (diff)
downloadaskama-f71b2f03230fe8a6f50c3a02dcfeaed920fbdca3.tar.gz
askama-f71b2f03230fe8a6f50c3a02dcfeaed920fbdca3.tar.bz2
askama-f71b2f03230fe8a6f50c3a02dcfeaed920fbdca3.zip
Add test for type parameters and where clauses (see #9)
Diffstat (limited to 'testing/tests/simple.rs')
-rw-r--r--testing/tests/simple.rs14
1 files changed, 14 insertions, 0 deletions
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<T: std::fmt::Display, U> 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");
+}