From 4633dd989c58e7707f681c0ffd651c8b5336d5a9 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 23 Apr 2020 13:36:26 +0200 Subject: Fix taking references of function arguments (fixes #311) --- testing/tests/simple.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'testing') diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index 7db8cb4..7241005 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -392,3 +392,13 @@ mod without_import_on_derive { assert_eq!(WithoutImport.render().unwrap(), "foo"); } } + +#[derive(askama::Template)] +#[template(source = "{% let s = String::new() %}{{ s }}", ext = "txt")] +struct DefineStringVar; + +#[test] +fn test_define_string_var() { + let template = DefineStringVar; + assert_eq!(template.render().unwrap(), ""); +} -- cgit