mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-30 14:31:36 +00:00
Add e2e test for escape
This commit is contained in:
parent
7e6eda2f69
commit
a899561db2
@ -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, <>&"'/!"
|
||||
);
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "simple-no-escape.txt")]
|
||||
struct VariablesTemplateNoEscape<'a> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user