mirror of
https://github.com/askama-rs/askama.git
synced 2026-03-13 18:08:23 +00:00
Merge pull request #688 from GuillaumeGomez/temporary-refs
Add regression test for temporary refs for #661
This commit is contained in:
commit
37264de1a9
@ -437,3 +437,19 @@ mod sub_test {
|
||||
assert_eq!(Foo { b: 0 }.render().unwrap(), "bar: 0");
|
||||
}
|
||||
}
|
||||
|
||||
// This test ensures that temporary variables behind references (like one generated
|
||||
// from `.borrow()`) still work.
|
||||
//
|
||||
// Regression test for <https://github.com/askama-rs/askama/issues/661>.
|
||||
#[test]
|
||||
fn test_temporary_refs() {
|
||||
#[derive(Template)]
|
||||
#[template(
|
||||
ext = "html",
|
||||
source = r#"{{ Some("x".to_string().as_str()).unwrap() }}"#
|
||||
)]
|
||||
struct Tpl;
|
||||
|
||||
assert_eq!(Tpl.render().unwrap(), "x");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user