Add e2e test for escape

This commit is contained in:
bott 2018-11-11 22:23:51 +01:00 committed by Dirkjan Ochtman
parent 7e6eda2f69
commit a899561db2

View File

@ -30,6 +30,22 @@ fn test_variables() {
assert_eq!(VariablesTemplate::extension(), Some("html"));
}
#[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> {