From f2ea1408cf9fb4baf2d68d6624161d104f115e37 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sat, 18 Feb 2017 14:02:59 +0100 Subject: Add test for format filter --- testing/templates/format.html | 1 + testing/tests/filters.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 testing/templates/format.html diff --git a/testing/templates/format.html b/testing/templates/format.html new file mode 100644 index 0000000..aba58fd --- /dev/null +++ b/testing/templates/format.html @@ -0,0 +1 @@ +{{ "{:?}"|format(var) }} diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs index d70d1c8..73b660a 100644 --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -18,3 +18,16 @@ fn filter_escape() { assert_eq!(s.render(), "my <html> is unsafe & should be escaped\n"); } + + +#[derive(Template)] +#[template(path = "format.html")] +struct FormatTemplate<'a> { + var: &'a str, +} + +#[test] +fn filter_format() { + let t = FormatTemplate { var: "formatted" }; + assert_eq!(t.render(), "\"formatted\"\n"); +} -- cgit