diff options
author | bott <mhpoin@gmail.com> | 2018-11-11 22:23:51 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-11-11 22:39:22 +0100 |
commit | a899561db2057b300176b704b92a4559d5895f68 (patch) | |
tree | ea6f890aa24c8baf4fa4f49bd1c3b7cc5667b40f /testing | |
parent | 7e6eda2f69fbe104be3823cabc31af9307b83a38 (diff) | |
download | askama-a899561db2057b300176b704b92a4559d5895f68.tar.gz askama-a899561db2057b300176b704b92a4559d5895f68.tar.bz2 askama-a899561db2057b300176b704b92a4559d5895f68.zip |
Add e2e test for escape
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, |