diff options
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, |