aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tests')
-rw-r--r--testing/tests/filters.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs
index 5a02909..4fe5c62 100644
--- a/testing/tests/filters.rs
+++ b/testing/tests/filters.rs
@@ -309,3 +309,17 @@ fn test_json_script() {
r#"<script>var user = "\u003c/script\u003e\u003cbutton\u003eHacked!\u003c/button\u003e"</script>"#
);
}
+
+#[derive(askama::Template)]
+#[template(source = "{% let word = s|as_ref %}{{ word }}", ext = "html")]
+struct LetBorrow {
+ s: String,
+}
+
+#[test]
+fn test_let_borrow() {
+ let template = LetBorrow {
+ s: "hello".to_owned(),
+ };
+ assert_eq!(template.render().unwrap(), "hello")
+}