diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-01-06 11:23:21 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-01-06 13:24:44 +0100 |
commit | 2000af89016f6145bf42b72afaafe68c0a8da4a4 (patch) | |
tree | 5dad1cd891ac4b3e5e42affb227c2d22856f4519 /testing/tests | |
parent | 825ad5f816657bb6602467784491f3430320b4a5 (diff) | |
download | askama-2000af89016f6145bf42b72afaafe68c0a8da4a4.tar.gz askama-2000af89016f6145bf42b72afaafe68c0a8da4a4.tar.bz2 askama-2000af89016f6145bf42b72afaafe68c0a8da4a4.zip |
Add basic test case for filters
Diffstat (limited to '')
-rw-r--r-- | testing/tests/filters.rs | 22 |
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 <html> is unsafe & should be escaped\n"); +} |