diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-02-18 14:02:59 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-02-18 14:02:59 +0100 |
commit | f2ea1408cf9fb4baf2d68d6624161d104f115e37 (patch) | |
tree | 107fef4f02222b5d976ec841af3dd9163a72cd7c /testing | |
parent | a4588dc02d82ed88084fdf94fc703bb02d2f9971 (diff) | |
download | askama-f2ea1408cf9fb4baf2d68d6624161d104f115e37.tar.gz askama-f2ea1408cf9fb4baf2d68d6624161d104f115e37.tar.bz2 askama-f2ea1408cf9fb4baf2d68d6624161d104f115e37.zip |
Add test for format filter
Diffstat (limited to 'testing')
-rw-r--r-- | testing/templates/format.html | 1 | ||||
-rw-r--r-- | testing/tests/filters.rs | 13 |
2 files changed, 14 insertions, 0 deletions
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"); +} |