askama/testing/tests/filters.rs
2017-01-06 13:24:44 +01:00

23 lines
445 B
Rust

#![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");
}