aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/simple.rs
diff options
context:
space:
mode:
authorLibravatar bott <mhpoin@gmail.com>2018-11-11 22:23:51 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-11-11 22:39:22 +0100
commita899561db2057b300176b704b92a4559d5895f68 (patch)
treeea6f890aa24c8baf4fa4f49bd1c3b7cc5667b40f /testing/tests/simple.rs
parent7e6eda2f69fbe104be3823cabc31af9307b83a38 (diff)
downloadaskama-a899561db2057b300176b704b92a4559d5895f68.tar.gz
askama-a899561db2057b300176b704b92a4559d5895f68.tar.bz2
askama-a899561db2057b300176b704b92a4559d5895f68.zip
Add e2e test for escape
Diffstat (limited to 'testing/tests/simple.rs')
-rw-r--r--testing/tests/simple.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index 2bf8e7a..7206add 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -31,6 +31,22 @@ fn test_variables() {
}
#[derive(Template)]
+#[template(path = "hello.html")]
+struct EscapeTemplate<'a> {
+ name: &'a str,
+}
+
+#[test]
+fn test_escape() {
+ let s = EscapeTemplate { name: "<>&\"'/" };
+
+ assert_eq!(
+ s.render().unwrap(),
+ "Hello, &lt;&gt;&amp;&quot;&#x27;&#x2f;!"
+ );
+}
+
+#[derive(Template)]
#[template(path = "simple-no-escape.txt")]
struct VariablesTemplateNoEscape<'a> {
strvar: &'a str,