Skip to content

Commit

Permalink
Add test for type parameters and where clauses (see #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Mar 8, 2017
1 parent c927d51 commit f71b2f0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions testing/tests/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

0 comments on commit f71b2f0

Please sign in to comment.