From c98297fe995d3a2e2d338208eb745b90533fdb3d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sat, 7 Jan 2017 22:12:52 +0100 Subject: Add test for else blocks --- testing/templates/else.html | 1 + testing/tests/simple.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 testing/templates/else.html (limited to 'testing') diff --git a/testing/templates/else.html b/testing/templates/else.html new file mode 100644 index 0000000..16255c8 --- /dev/null +++ b/testing/templates/else.html @@ -0,0 +1 @@ +{% if cond %}true{% else %}false{% endif %} diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index d17cae3..6515146 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -39,3 +39,16 @@ fn test_if() { let s = IfTemplate { cond: true }; assert_eq!(s.render(), "true\n"); } + + +#[derive(Template)] +#[template(path = "else.html")] +struct ElseTemplate { + cond: bool, +} + +#[test] +fn test_else() { + let s = ElseTemplate { cond: false }; + assert_eq!(s.render(), "false\n"); +} -- cgit