diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-06-25 14:46:07 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-06-25 14:46:07 +0200 |
commit | c44869d7c6741ef4b9ce1c905baf917733019799 (patch) | |
tree | b4098a50641ab5071e6cc09a96864eb0443db190 /testing | |
parent | cd58a6943071c92a17e534849866c1cdf576737a (diff) | |
download | askama-c44869d7c6741ef4b9ce1c905baf917733019799.tar.gz askama-c44869d7c6741ef4b9ce1c905baf917733019799.tar.bz2 askama-c44869d7c6741ef4b9ce1c905baf917733019799.zip |
Add test for 'truncate' filter
Diffstat (limited to 'testing')
-rw-r--r-- | testing/tests/filters.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs index 96f03f6..e05e1f6 100644 --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -155,3 +155,17 @@ fn test_filter_let_filter() { }; assert_eq!(t.render().unwrap(), "BAR"); } + +#[derive(Template)] +#[template(source = "{{ foo|truncate(10) }}{{ foo|truncate(5) }}", ext = "txt", print = "code")] +struct TruncateFilter { + foo: String, +} + +#[test] +fn test_filter_truncate() { + let t = TruncateFilter { + foo: "alpha bar".into(), + }; + assert_eq!(t.render().unwrap(), "alpha baralpha..."); +} |