diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/templates/rust-macros.html | 1 | ||||
-rw-r--r-- | testing/tests/rust_macro.rs | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/testing/templates/rust-macros.html b/testing/templates/rust-macros.html new file mode 100644 index 0000000..dc0b3de --- /dev/null +++ b/testing/templates/rust-macros.html @@ -0,0 +1 @@ +Hello, {{ hello!(name) }}! diff --git a/testing/tests/rust_macro.rs b/testing/tests/rust_macro.rs new file mode 100644 index 0000000..c6e97ce --- /dev/null +++ b/testing/tests/rust_macro.rs @@ -0,0 +1,22 @@ +#[macro_use] +extern crate askama; + +use askama::Template; + +macro_rules! hello { + ($name:expr) => { + "world" + } +} + +#[derive(Template)] +#[template(path = "rust-macros.html")] +struct RustMacrosTemplate<'a> { + name: &'a str, +} + +#[test] +fn main() { + let template = RustMacrosTemplate { name: "foo" }; + assert_eq!("Hello, world!", template.render().unwrap()); +} |