aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLibravatar max <gmx.sht@gmail.com>2023-12-13 15:34:54 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-12-13 16:47:02 +0100
commit3d52283b74573af509deb3c47cbabf7b7b58b1dd (patch)
tree3abd5a1a4f903dd305c83a7474a4bbb1f7598df9 /testing
parent28182a1549a6546750d3f9834cb35686b89c3cf9 (diff)
downloadaskama-3d52283b74573af509deb3c47cbabf7b7b58b1dd.tar.gz
askama-3d52283b74573af509deb3c47cbabf7b7b58b1dd.tar.bz2
askama-3d52283b74573af509deb3c47cbabf7b7b58b1dd.zip
Add automatic borrowing to let statement
Signed-off-by: max <gmx.sht@gmail.com>
Diffstat (limited to '')
-rw-r--r--testing/tests/simple.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index f0f0a26..55353f5 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -484,3 +484,17 @@ fn test_num_literals() {
"[90, -90, 90, 2, 56, 240, 10.5, 10.5, 100000000000, 105000000000]",
);
}
+
+#[derive(askama::Template)]
+#[template(source = "{% let word = s %}{{ 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")
+}