From cbea9814d28763035195a87bc3fcfb54c64ebe7b Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 27 Apr 2018 13:44:31 +0200 Subject: Add test for ! operator (see #83) --- testing/tests/simple.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'testing') diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index c9c3c0c..f532eaa 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -207,3 +207,16 @@ fn test_comment() { let t = CommentTemplate {}; assert_eq!(t.render().unwrap(), " "); } + + +#[derive(Template)] +#[template(source = "{% if !foo %}Hello{% endif %}", ext = "txt")] +struct NegationTemplate { + foo: bool, +} + +#[test] +fn test_negation() { + let t = NegationTemplate { foo: false }; + assert_eq!(t.render().unwrap(), "Hello"); +} -- cgit