diff options
author | Pavel Fokin <fokinpv@gmail.com> | 2019-04-11 07:48:38 +0300 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2019-04-18 09:38:39 +0200 |
commit | e29792e90ce438875a13becdeb9c030b1d3132e4 (patch) | |
tree | 769e7a997231beeac0af279dd985a54b209498ae /testing/tests/simple.rs | |
parent | 3825a2bb5ac6f1ad08b6b5d796d4271e4a38761e (diff) | |
download | askama-e29792e90ce438875a13becdeb9c030b1d3132e4.tar.gz askama-e29792e90ce438875a13becdeb9c030b1d3132e4.tar.bz2 askama-e29792e90ce438875a13becdeb9c030b1d3132e4.zip |
WIP: Add raw block
Diffstat (limited to '')
-rw-r--r-- | testing/tests/simple.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index f192609..e4239ce 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -300,6 +300,29 @@ fn test_empty() { assert_eq!(Empty.render().unwrap(), "foo"); } +#[derive(Template)] +#[template(path = "raw-simple.html")] +struct RawTemplate; + +#[test] +fn test_raw_simple() { + let template = RawTemplate; + assert_eq!(template.render().unwrap(), "\n<span>{{ name }}</span>\n"); +} + +#[derive(Template)] +#[template(path = "raw-complex.html")] +struct RawTemplateComplex; + +#[test] +fn test_raw_complex() { + let template = RawTemplateComplex; + assert_eq!( + template.render().unwrap(), + "\n{% block name %}\n <span>{{ name }}</span>\n{% endblock %}\n" + ); +} + mod without_import_on_derive { #[derive(askama::Template)] #[template(source = "foo", ext = "txt")] |