aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLibravatar imaperson <mhpoin@gmail.com>2018-11-11 23:48:00 +0100
committerLibravatar GitHub <noreply@github.com>2018-11-11 23:48:00 +0100
commit0a7e35c7e39835b4351af8c7469e5de0ba633a4d (patch)
treeea6f890aa24c8baf4fa4f49bd1c3b7cc5667b40f /testing
parenteb5f35ef9bdc385ab24533bc47acd8c8eb7313c3 (diff)
parenta899561db2057b300176b704b92a4559d5895f68 (diff)
downloadaskama-0a7e35c7e39835b4351af8c7469e5de0ba633a4d.tar.gz
askama-0a7e35c7e39835b4351af8c7469e5de0ba633a4d.tar.bz2
askama-0a7e35c7e39835b4351af8c7469e5de0ba633a4d.zip
Merge pull request #155 from djc/simplify-expr-writing
Simplify expr writing
Diffstat (limited to '')
-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,