mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-27 13:00:57 +00:00
Add regression test for moving variables in let statement
This commit is contained in:
parent
fa467172dd
commit
e7f2979b73
@ -39,7 +39,7 @@ fn test_ref_deref() {
|
||||
#[derive(Template)]
|
||||
#[template(
|
||||
source = r#"
|
||||
{%- let x = *title -%}
|
||||
{%- let x = **title -%}
|
||||
{%- if x == "another" -%}
|
||||
another2
|
||||
{%- else -%}
|
||||
|
@ -131,3 +131,23 @@ fn test_decl_assign_range() {
|
||||
let t = DeclAssignRange;
|
||||
assert_eq!(t.render().unwrap(), "1");
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(
|
||||
source = "
|
||||
{%- set t = title -%}
|
||||
{{t}}/{{title -}}
|
||||
",
|
||||
ext = "txt"
|
||||
)]
|
||||
struct DoNotMoveFields {
|
||||
title: String,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_not_moving_fields_in_var() {
|
||||
let x = DoNotMoveFields {
|
||||
title: "a".to_string(),
|
||||
};
|
||||
assert_eq!(x.render().unwrap(), "a/a");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user