diff --git a/testing/tests/let.rs b/testing/tests/let.rs new file mode 100644 index 000000000..282720992 --- /dev/null +++ b/testing/tests/let.rs @@ -0,0 +1,23 @@ +use rinja::Template; + +#[derive(Template)] +#[template( + source = r#"{%- let x -%} +{%- if y -%} + {%- let x = String::new() %} +{%- else -%} + {%- let x = format!("blob") %} +{%- endif -%} +{{ x }}"#, + ext = "html" +)] +struct A { + y: bool, +} + +// This test ensures that rust macro calls in `let`/`set` statements are not prepended with `&`. +#[test] +fn let_macro() { + let template = A { y: false }; + assert_eq!(template.render().unwrap(), "blob") +}