From 2000af89016f6145bf42b72afaafe68c0a8da4a4 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 6 Jan 2017 11:23:21 +0100 Subject: Add basic test case for filters --- testing/tests/filters.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 testing/tests/filters.rs (limited to 'testing/tests') 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 is unsafe & should be escaped".to_string(), + }; + assert_eq!(s.render(), + "my <html> is unsafe & should be escaped\n"); +} -- cgit