Skip to content

Commit

Permalink
Add regression test for rust macro calls not prepended with &
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 18, 2024
1 parent 7d2ca77 commit 40d10ce
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions testing/tests/let.rs
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 40d10ce

Please sign in to comment.