diff options
Diffstat (limited to 'testing/tests')
-rw-r--r-- | testing/tests/vars.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testing/tests/vars.rs b/testing/tests/vars.rs index 3af41c6..d1c41f9 100644 --- a/testing/tests/vars.rs +++ b/testing/tests/vars.rs @@ -55,3 +55,18 @@ fn test_self_iter() { let t = SelfIterTemplate(vec![1, 2, 3]); assert_eq!(t.render().unwrap(), "123"); } + +#[derive(Template)] +#[template( + source = "{% if true %}{% let t = a.unwrap() %}{{ t }}{% endif %}", + ext = "txt" +)] +struct IfLet { + a: Option<&'static str>, +} + +#[test] +fn test_if_let() { + let t = IfLet { a: Some("foo") }; + assert_eq!(t.render().unwrap(), "foo"); +} |