diff options
author | imaperson <mhpoin@gmail.com> | 2018-11-11 23:48:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-11 23:48:00 +0100 |
commit | 0a7e35c7e39835b4351af8c7469e5de0ba633a4d (patch) | |
tree | ea6f890aa24c8baf4fa4f49bd1c3b7cc5667b40f /testing | |
parent | eb5f35ef9bdc385ab24533bc47acd8c8eb7313c3 (diff) | |
parent | a899561db2057b300176b704b92a4559d5895f68 (diff) | |
download | askama-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.rs | 16 |
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, <>&"'/!" + ); +} + +#[derive(Template)] #[template(path = "simple-no-escape.txt")] struct VariablesTemplateNoEscape<'a> { strvar: &'a str, |