diff options
author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-01-10 15:10:06 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2024-01-12 10:38:15 +0100 |
commit | 12e178ce405225f2cd65ab4f68b67fefc89dec2b (patch) | |
tree | b2916e25659ff6ef51839306fa8bd0f1a8d572d1 /testing | |
parent | d5fbebecbd746e4dda0bcd81cb861b61afd8a309 (diff) | |
download | askama-12e178ce405225f2cd65ab4f68b67fefc89dec2b.tar.gz askama-12e178ce405225f2cd65ab4f68b67fefc89dec2b.tar.bz2 askama-12e178ce405225f2cd65ab4f68b67fefc89dec2b.zip |
Add test for `as_ref` builtin filter
Diffstat (limited to '')
-rw-r--r-- | testing/tests/filters.rs | 14 |
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") +} |