From 98c7acd21653481c54c5b556073b1b5e0332f075 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 29 Jan 2026 17:13:10 +0100 Subject: [PATCH] Add regression test for temporary refs for #661 --- testing/tests/calls.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/testing/tests/calls.rs b/testing/tests/calls.rs index 1e921281..97e26e91 100644 --- a/testing/tests/calls.rs +++ b/testing/tests/calls.rs @@ -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 . +#[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"); +}