aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/tests/filters.rs22
1 files changed, 22 insertions, 0 deletions
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 &lt;html&gt; is unsafe &amp; should be escaped\n");
+}