diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/templates/filters.html | 1 | ||||
-rw-r--r-- | testing/tests/filters.rs | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/testing/templates/filters.html b/testing/templates/filters.html new file mode 100644 index 0000000..77f5048 --- /dev/null +++ b/testing/templates/filters.html @@ -0,0 +1 @@ +{{ strvar|e }} diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs new file mode 100644 index 0000000..abde750 --- /dev/null +++ b/testing/tests/filters.rs @@ -0,0 +1,22 @@ +#![feature(proc_macro)] + +#[macro_use] +extern crate askama_derive; +extern crate askama; + +use askama::Template; + +#[derive(Template)] +#[template(path = "filters.html")] +struct TestTemplate { + strvar: String, +} + +#[test] +fn filter_escape() { + let s = TestTemplate { + strvar: "my <html> is unsafe & should be escaped".to_string(), + }; + assert_eq!(s.render(), + "my <html> is unsafe & should be escaped\n"); +} |