aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/tests/filters.rs14
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...");
+}